pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:944:    *! and the iterator index will be returned. If @[needle] is not    *! found, @[haystack] will be advanced to the end.    *! @endmixed    *!    *! @param start    *! If the optional argument @[start] is present search is started at    *! this position. This has no effect on mappings.    *!    *! @param end    *! If the optional argument @[end] is present, the search will terminate -  *! at this position if not found earlier. +  *! at this position (exclusive) if not found earlier.    *!    *! @returns    *! Returns the position of @[needle] in @[haystack] if found.    *!    *! If not found the returned value depends on the type of @[haystack]:    *! @mixed    *! @type string|array    *! @expr{-1@}.    *! @type mapping|object(Iterator)    *! @[UNDEFINED].
pike.git/src/builtin_functions.c:1084:    }    }    break;    }    } else if(TYPEOF(Pike_sp[1-args]) == T_STRING) {    /* Handle searching for the empty string. */    if (Pike_sp[1-args].u.string->len) {    start = string_search(haystack,    Pike_sp[1-args].u.string,    start); +  end -= Pike_sp[1-args].u.string->len-1;    }    } else {    SIMPLE_ARG_TYPE_ERROR("search", 2, "string | int");    }    pop_n_elems(args);    if (start >= end) {    start = -1;    }    push_int64(start);    break;