pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:6557:    int i,j,top=0;    struct array *a;    struct diff_magic_link_pool *pools=NULL;    struct diff_magic_link *dml;    struct diff_magic_link **stack;    char *marks;       if(!cmptbl->size)    return allocate_array(0);    -  stack = malloc(sizeof(struct diff_magic_link*)*cmptbl->size); +  stack = xcalloc(sizeof(struct diff_magic_link*), cmptbl->size);    -  if (!stack) { -  int args = 0; -  SIMPLE_OUT_OF_MEMORY_ERROR("diff_longest_sequence", -  (int)sizeof(struct diff_magic_link*) * -  cmptbl->size); -  } -  +     /* NB: marks is used for optimization purposes only */    marks = calloc(blen, 1);       if (!marks && blen) {    int args = 0;    free(stack);    SIMPLE_OUT_OF_MEMORY_ERROR("diff_longest_sequence", blen);    }      #ifdef DIFF_DEBUG
pike.git/src/builtin_functions.c:6777:    struct array *res = NULL;    struct diff_magic_link_head *table;    struct diff_magic_link_pool *dml_pool = NULL;    struct diff_magic_link *dml;    unsigned int sz = (unsigned int)cmptbl->size;    unsigned int i;    unsigned int off1 = 0;    unsigned int off2 = blen + 1;    ONERROR err;    -  table = calloc(sizeof(struct diff_magic_link_head)*2, off2); -  if (!table) { -  int args = 0; -  SIMPLE_OUT_OF_MEMORY_ERROR("diff_dyn_longest_sequence", -  sizeof(struct diff_magic_link_head) * 2 * off2); -  } +  table = xcalloc(sizeof(struct diff_magic_link_head)*2, off2);       /* FIXME: Assumes NULL is represented with all zeroes */    /* NOTE: Scan strings backwards to get the same result as the G-M    * algorithm.    */    for (i = sz; i--;) {    struct array *boff = cmptbl->item[i].u.array;      #ifdef DIFF_DEBUG    fprintf(stderr, " i:%d\n", i);