392:df62b7205bd3 | 393:3099bf907e21 |
---|---|
80 | 80 |
81 size_t n; | 81 size_t n; |
82 for (n = 0; groups[n] > -1; n++) { } | 82 for (n = 0; groups[n] > -1; n++) { } |
83 | 83 |
84 if (ngroups > 0) { | 84 if (ngroups > 0) { |
85 int* newarray = calloc(n, sizeof(int)); | 85 int* newarray = calloc(n+1, sizeof(int)); |
86 memcpy(newarray, groups, n * sizeof(int)); | 86 memcpy(newarray, groups, n * sizeof(int)); |
87 newarray[n] = -1; | |
87 *ngroups = n; | 88 *ngroups = n; |
88 return newarray; | 89 return newarray; |
89 } | 90 } |
90 return NULL; | 91 return NULL; |
91 } | 92 } |