[alsa-cvslog] CVS: alsa-lib/src conf.c,1.85,1.86 confmisc.c,1.35,1.36 names.c,1.4,1.5
Brought to you by:
perex
From: Clemens L. <cla...@us...> - 2006-02-27 09:58:41
|
Update of /cvsroot/alsa/alsa-lib/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21049/alsa-lib/src Modified Files: conf.c confmisc.c names.c Log Message: Summary: remove superfluous free() checks free() correctly handles NULL pointers, so we can omit explicit checks for that condition. Index: conf.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/conf.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- conf.c 30 Jan 2006 14:41:52 -0000 1.85 +++ conf.c 27 Feb 2006 09:58:32 -0000 1.86 @@ -980,8 +980,7 @@ if (err < 0) return err; } - if (n->u.string) - free(n->u.string); + free(n->u.string); n->u.string = s; *_n = n; return 0; @@ -1056,8 +1055,7 @@ } err = 0; __end: - if (id) - free(id); + free(id); return err; } @@ -1218,8 +1216,7 @@ unget_char(c, input); } __end: - if (id) - free(id); + free(id); return err; } @@ -1446,8 +1443,7 @@ if (err < 0) return err; } - if (dst->id) - free(dst->id); + free(dst->id); dst->id = src->id; dst->type = src->type; dst->u = src->u; @@ -1528,8 +1524,7 @@ new_id = strdup(id); if (!new_id) return -ENOMEM; - if (config->id) - free(config->id); + free(config->id); config->id = new_id; return 0; } @@ -1696,16 +1691,14 @@ break; } case SND_CONFIG_TYPE_STRING: - if (config->u.string) - free(config->u.string); + free(config->u.string); break; default: break; } if (config->father) list_del(&config->list); - if (config->id) - free(config->id); + free(config->id); free(config); return 0; } @@ -2023,8 +2016,7 @@ } else { new_string = NULL; } - if (config->u.string) - free(config->u.string); + free(config->u.string); config->u.string = new_string; return 0; } @@ -2091,8 +2083,7 @@ char *ptr = strdup(ascii); if (ptr == NULL) return -ENOMEM; - if (config->u.string) - free(config->u.string); + free(config->u.string); config->u.string = ptr; } break; @@ -2702,8 +2693,7 @@ if (err >= 0 && nroot) err = snd_config_substitute(root, nroot); } - if (buf) - free(buf); + free(buf); if (err < 0) return err; return 0; @@ -2844,11 +2834,10 @@ *dst = NULL; err = 0; _err: - for (idx = 0; idx < fi_count; idx++) - if (fi[idx].name) - free(fi[idx].name); - if (fi) - free(fi); + if (fi) + for (idx = 0; idx < fi_count; idx++) + free(fi[idx].name); + free(fi); snd_config_delete(n); return err; } @@ -2905,8 +2894,7 @@ __err: if (private_data) snd_config_delete(private_data); - if (fdriver) - free(fdriver); + free(fdriver); if (err < 0) return err; } @@ -3108,8 +3096,7 @@ assert(update); for (k = 0; k < update->count; k++) free(update->finfo[k].name); - if (update->finfo) - free(update->finfo); + free(update->finfo); free(update); return 0; } @@ -3500,8 +3487,7 @@ } } _errbuf: - if (buf) - free(buf); + free(buf); if (err < 0) return err; return 0; Index: confmisc.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/confmisc.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- confmisc.c 29 Sep 2005 11:46:59 -0000 1.35 +++ confmisc.c 27 Feb 2006 09:58:32 -0000 1.36 @@ -295,8 +295,7 @@ free(res); } __error: - if (def) - free(def); + free(def); return err; } #ifndef DOC_HIDDEN @@ -419,8 +418,7 @@ tmp = realloc(res, len + len1 + 1); if (tmp == NULL) { free(ptr); - if (res) - free(res); + free(res); err = -ENOMEM; goto __error; } Index: names.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/names.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- names.c 6 Jun 2005 14:01:13 -0000 1.4 +++ names.c 27 Feb 2006 09:58:32 -0000 1.5 @@ -105,17 +105,14 @@ } last = dn; } else { - if (comment != NULL) - free(comment); + free(comment); } } return 0; _err: - if (name) - free(name); - if (comment) - free(comment); + free(name); + free(comment); return err; } @@ -189,10 +186,8 @@ while (list != NULL) { next = list->next; - if (list->name) - free(list->name); - if (list->comment) - free(list->comment); + free(list->name); + free(list->comment); free(list); list = next; } |