[Fingerforce-commits] [libfprint] 04/20: lib: Use g_malloc0 instead of g_malloc+memset
Didier Raboud
odyx at alioth.debian.org
Sun Sep 29 13:43:36 UTC 2013
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch master
in repository libfprint.
commit f3dd55815ec1ef357e343ae1a810c6728d3ffd9a
Author: Bastien Nocera <hadess at hadess.net>
Date: Wed Jun 26 14:21:33 2013 +0200
lib: Use g_malloc0 instead of g_malloc+memset
---
libfprint/data.c | 3 +--
libfprint/img.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/libfprint/data.c b/libfprint/data.c
index 3371a0c..bfbf8fb 100644
--- a/libfprint/data.c
+++ b/libfprint/data.c
@@ -97,9 +97,8 @@ static const char *finger_num_to_str(enum fp_finger finger)
static struct fp_print_data *print_data_new(uint16_t driver_id,
uint32_t devtype, enum fp_print_data_type type, size_t length)
{
- struct fp_print_data *data = g_malloc(sizeof(*data) + length);
+ struct fp_print_data *data = g_malloc0(sizeof(*data) + length);
fp_dbg("length=%zd driver=%02x devtype=%04x", length, driver_id, devtype);
- memset(data, 0, sizeof(*data));
data->driver_id = driver_id;
data->devtype = devtype;
data->type = type;
diff --git a/libfprint/img.c b/libfprint/img.c
index 64a6240..b1d32ed 100644
--- a/libfprint/img.c
+++ b/libfprint/img.c
@@ -47,8 +47,7 @@
struct fp_img *fpi_img_new(size_t length)
{
- struct fp_img *img = g_malloc(sizeof(*img) + length);
- memset(img, 0, sizeof(*img));
+ struct fp_img *img = g_malloc0(sizeof(*img) + length);
fp_dbg("length=%zd", length);
img->length = length;
return img;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/fingerforce/libfprint.git
More information about the Fingerforce-commits
mailing list