comparison m_option.c @ 30702:9fc9d1e788aa

Do not cast the results of malloc/calloc/realloc. These functions return void*, which is compatible with any pointer, so there is no need for casts.
author diego
date Fri, 26 Feb 2010 15:01:37 +0000
parents a26f6577d338
children 92f88bb315c5
comparison
equal deleted inserted replaced
30701:3c1f75f4affe 30702:9fc9d1e788aa
1009 } 1009 }
1010 r = m_option_parse(&subopts[i],subopt, 1010 r = m_option_parse(&subopts[i],subopt,
1011 subparam[0] == 0 ? NULL : subparam,NULL,src); 1011 subparam[0] == 0 ? NULL : subparam,NULL,src);
1012 if(r < 0) return r; 1012 if(r < 0) return r;
1013 if(dst) { 1013 if(dst) {
1014 lst = (char**)realloc(lst,2 * (nr+2) * sizeof(char*)); 1014 lst = realloc(lst,2 * (nr+2) * sizeof(char*));
1015 lst[2*nr] = strdup(subopt); 1015 lst[2*nr] = strdup(subopt);
1016 lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam); 1016 lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam);
1017 memset(&lst[2*(nr+1)],0,2*sizeof(char*)); 1017 memset(&lst[2*(nr+1)],0,2*sizeof(char*));
1018 nr++; 1018 nr++;
1019 } 1019 }