| | 53 | | | | int * | | | 54 | | | | gs_realloc_int_array(nelems, maxelems, array, inc, init, caller) | | | 55 | | | | int nelems; | | | 56 | | | | int *maxelems; | | | 57 | | | | int *array; | | | 58 | | | | int inc; | | | 59 | | | | int init; | | | 60 | | | | char *caller; | | | 61 | | | | { | | | 62 | | | | int i; | | | 63 | | | | int *newarray, *newvalue; | | | 64 | | | | int oldmax; | | | 65 | | | | int *value; | | | 66 | | | | | | | 67 | | | | if (nelems <= *maxelems) | | | 68 | | | | return(array); | | | 69 | | | | | | | 70 | | | | newarray = array; | | | 71 | | | | | | | 72 | | | | oldmax = *maxelems; | | | 73 | | | | | | | 74 | | | | *maxelems += inc; | | | 75 | | | | | | | 76 | | | | if ( (newarray = (int *) PVM_ALLOC(sizeof(int) * (*maxelems), caller))
| | true | 77 | | | | == (int *) NULL)
| | | 78 | | | | { | | $unknown_82662517 <= 4095 | 79 | | | | fprintf(stderr, "could not allocate memory: %s\n", caller); | | $unknown_82662525 <= 4095 | 80 | | | | return(newarray); | | | 81 | | | | } | | | 82 | | | | | | | 83 | | | | | | | 84 | | | | | | | 85 | | | | if (oldmax > 0) | | | 86 | | | | BCOPY(array, newarray, oldmax*sizeof(int));
| | | 87 | | | | | | | 88 | | | | newvalue = newarray+oldmax; | | | 89 | | | | | | | 90 | | | | for (i = oldmax; i < *maxelems; i++) | | | 91 | | | | *newvalue++ = init; | | | 92 | | | | | | | 93 | | | | if (array != (int *) NULL)
| | | 94 | | | | PVM_FREE(array);
| | | 95 | | | | | | | 96 | | | | return(newarray); | | gs_realloc_int_array$return <= 4095 | 97 | | | | } | Problem | | gs_realloc_int_array$return <= 4095 |
|
|