Author: pschweitzer
Date: Sun Jul 21 16:15:16 2013
New Revision: 59548
URL:
http://svn.reactos.org/svn/reactos?rev=59548&view=rev
Log:
[CDMAKE]
Use calloc instead of malloc + memset
Modified:
trunk/reactos/tools/cdmake/cdmake.c
trunk/reactos/tools/cdmake/dirhash.c
Modified: trunk/reactos/tools/cdmake/cdmake.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
==============================================================================
--- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sun Jul 21 16:15:16 2013
@@ -652,10 +652,9 @@
{
PDIR_RECORD d;
- d = malloc(sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(DIR_RECORD));
if (d == NULL)
error_exit("Insufficient memory");
- memset ( d, 0, sizeof(DIR_RECORD) );
d->next_in_memory = root.next_in_memory;
root.next_in_memory = d;
@@ -687,10 +686,9 @@
char *n;
*/
- d = malloc(sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(DIR_RECORD));
if (d == NULL)
error_exit("Insufficient memory");
- memset ( d, 0, sizeof(DIR_RECORD) );
d->next_in_memory = root.next_in_memory;
root.next_in_memory = d;
@@ -1071,8 +1069,7 @@
new_empty_dirrecord(PDIR_RECORD d, BOOL directory)
{
PDIR_RECORD new_d;
- new_d = malloc(sizeof(*new_d));
- memset(new_d, 0, sizeof(*new_d));
+ new_d = calloc(1, sizeof(*new_d));
new_d->parent = d;
new_d->level = d->level + 1;
new_d->next_in_directory = d->first_record;
Modified: trunk/reactos/tools/cdmake/dirhash.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirhash.c?rev…
==============================================================================
--- trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] Sun Jul 21 16:15:16 2013
@@ -111,8 +111,7 @@
free(parentname);
free(parentcase);
hashcode = djb_hash(targetnorm);
- de = malloc(sizeof(*de));
- memset(de, 0, sizeof(*de));
+ de = calloc(1, sizeof(*de));
de->parent = parent_de;
de->normalized_name = strdup(targetnorm);
de->case_name = strdup(chop_filename(casename));
@@ -139,8 +138,7 @@
targetnorm = strdup(targetdir);
normalize_dirname(targetnorm);
de = dir_hash_create_dir(dh, targetdir, targetnorm);
- tf = malloc(sizeof(*tf));
- memset(tf, 0, sizeof(*tf));
+ tf = calloc(1, sizeof(*tf));
tf->next = de->head;
de->head = tf;
tf->source_name = strdup(source);