pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1151:    SIMPLE_ARG_TYPE_ERROR("has_prefix", 2, "string");       b = Pike_sp[1-args].u.string;       if (TYPEOF(Pike_sp[-args]) == T_OBJECT) {    ptrdiff_t i;    struct object *o = Pike_sp[-args].u.object;    int inherit_no = SUBTYPEOF(Pike_sp[-args]);       if (!o->prog || FIND_LFUN(o->prog, LFUN__SIZEOF) < 0) { -  Pike_error("has_prefix(): Object in argument 1 lacks lfun::_sizeof().\n"); +  Pike_error("Object in argument 1 lacks lfun::_sizeof().\n");    }       apply_lfun(o, LFUN__SIZEOF, 0);    if ((TYPEOF(Pike_sp[-1]) != T_INT) || (Pike_sp[-1].u.integer < b->len)) {    pop_n_elems(args + 1);    push_int(0);    return;    }       for (i = 0; i < b->len; i++) {
pike.git/src/builtin_functions.c:1225:    pop_n_elems(args); \    push_int(len == -1); \    return; \    } \    break       CASE_SHIFT(1,0);    CASE_SHIFT(2,0);    CASE_SHIFT(2,1);    default: -  Pike_error("has_prefix(): Unexpected string shift combination: a:%d, b:%d!\n", +  Pike_error("Unexpected string shift combination: a:%d, b:%d!\n",    a->size_shift, b->size_shift);    break;    }   #undef CASE_SHIFT   #undef TWO_SHIFTS   }      /*! @decl int has_suffix(string s, string suffix)    *!    *! Returns @expr{1@} if the string @[s] ends with @[suffix],
pike.git/src/builtin_functions.c:1299:    pop_n_elems(args); \    push_int(len == -1); \    return; \    } \    break       CASE_SHIFT(1,0);    CASE_SHIFT(2,0);    CASE_SHIFT(2,1);    default: -  Pike_error("has_prefix(): Unexpected string shift combination: a:%d, b:%d!\n", +  Pike_error("Unexpected string shift combination: a:%d, b:%d!\n",    a->size_shift, b->size_shift);    break;    }   #undef CASE_SHIFT   #undef TWO_SHIFTS   }      /*! @decl int has_index(string haystack, int index)    *! @decl int has_index(array haystack, int index)    *! @decl int has_index(mapping|multiset|object|program haystack, mixed index)
pike.git/src/builtin_functions.c:1745:    p_wchar2 *str2 = STR2(in);    ptrdiff_t j;    len = in->len * 2;    /* Check how many extra wide characters there are. */    for(i = in->len; i--;) {    if (str2[i] > 0xfffd) {    if (str2[i] < 0x10000) {    /* 0xfffe: Byte-order detection illegal character.    * 0xffff: Illegal character.    */ -  Pike_error("string_to_unicode(): Illegal character 0x%04x (index %ld) " +  Pike_error("Illegal character 0x%04x (index %ld) "    "is not a Unicode character.",    str2[i], PTRDIFF_T_TO_LONG(i));    }    if (str2[i] > 0x10ffff) { -  Pike_error("string_to_unicode(): Character 0x%08x (index %ld) " +  Pike_error("Character 0x%08x (index %ld) "    "is out of range (0x00000000..0x0010ffff).",    str2[i], PTRDIFF_T_TO_LONG(i));    }    /* Extra wide characters take two unicode characters in space.    * ie One unicode character extra.    */    len += 2;    }    }    out = begin_shared_string(len);
pike.git/src/builtin_functions.c:2502:    }    }    out_str[j++] = c;    }    break;    }    }      #ifdef PIKE_DEBUG    if (j != len) { -  Pike_fatal("utf8_to_string(): Calculated and actual lengths differ: " +  Pike_fatal("Calculated and actual lengths differ: "    "%"PRINTPTRDIFFT"d != %"PRINTPTRDIFFT"d\n",    len, j);    }   #endif /* PIKE_DEBUG */    out = low_end_shared_string(out);   #ifdef PIKE_DEBUG    check_string (out);   #endif    pop_n_elems(args);    push_string(out);
pike.git/src/builtin_functions.c:6335:       /* Initialize the min array */    for (i = 0; i < arr->size; i++) {    struct mapping_data *md;    /* e and k are used by NEW_MAPPING_LOOP() */    INT32 e;    struct keypair *k;    INT_TYPE low = MAX_INT_TYPE;   #ifdef PIKE_DEBUG    if (TYPEOF(ITEM(arr)[i]) != T_MAPPING) { -  Pike_error("interleave_array(): Element %d is not a mapping!\n", i); +  Pike_error("Element %d is not a mapping!\n", i);    }   #endif /* PIKE_DEBUG */    md = ITEM(arr)[i].u.mapping->data;    NEW_MAPPING_LOOP(md) {    if (TYPEOF(k->ind) != T_INT) { -  Pike_error("interleave_array(): Index not an integer in mapping %d!\n", i); +  Pike_error("Index not an integer in mapping %d!\n", i);    }    if (low > k->ind.u.integer) {    low = k->ind.u.integer;    if (low < 0) { -  Pike_error("interleave_array(): Index %"PRINTPIKEINT"d in mapping %d is negative!\n", +  Pike_error("Index %"PRINTPIKEINT"d in mapping %d is negative!\n",    low, i);    }    }    if (max < k->ind.u.integer) {    max = k->ind.u.integer;    }    nelems++;    }    ITEM(min)[i].u.integer = low;    }
pike.git/src/builtin_functions.c:6432:    while(tab[minfree]) {    minfree++;    }    ITEM(min)[i].u.integer = offset;       /* Check need for realloc */    if (offset >= size) {    char *newtab = realloc(tab, size*2 + max);    if (!newtab) {    free(tab); -  Pike_error("interleave_array(): Couldn't extend table!\n"); +  Pike_error("Couldn't extend table!\n");    }    tab = newtab;    MEMSET(tab + size + max, 0, size);    size = size * 2;    }    }    free(tab);    }       /* We want these two to survive the stackpopping. */