summaryrefslogtreecommitdiff
path: root/src/algo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/algo.h')
-rw-r--r--src/algo.h49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/algo.h b/src/algo.h
index d5ad9d7..f196372 100644
--- a/src/algo.h
+++ b/src/algo.h
@@ -659,52 +659,3 @@ static int ud_tfind (lua_State *L) {
static int ud_exec (lua_State *L) {
return generic_find_method (L, METHOD_EXEC);
}
-
-
-/* function plainfind (s, p, [st], [ci]) */
-/* (optimized for performance at the expense of code size) */
-static int plainfind_func (lua_State *L) {
- size_t textlen, patlen;
- const char *text = luaL_checklstring (L, 1, &textlen);
- const char *pattern = luaL_checklstring (L, 2, &patlen);
- const char *from = text + get_startoffset (L, 3, textlen);
- int ci = lua_toboolean (L, 4);
- const char *end = text + textlen - patlen;
-
- if (patlen == 0 && from <= end)
- goto found;
- if (ci ) {
- for (; from <= end; ++from) {
- if (toupper(*from) == toupper(*pattern)) {
- const char *f = from, *p = pattern;
- size_t len = patlen;
- while (--len) {
- if (toupper (*++f) != toupper (*++p))
- break;
- }
- if (len == 0)
- goto found;
- }
- }
- }
- else {
- for (; from <= end; ++from) {
- if (*from == *pattern) {
- const char *f = from, *p = pattern;
- size_t len = patlen;
- while (--len) {
- if (*++f != *++p)
- break;
- }
- if (len == 0)
- goto found;
- }
- }
- }
- lua_pushnil (L);
- return 1;
-found:
- lua_pushinteger (L, from - text + 1);
- lua_pushinteger (L, from - text + patlen);
- return 2;
-}