MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add optional start position for string includes

+11 -2
+1 -1
meson.build
··· 96 96 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 97 97 98 98 version_conf = configuration_data() 99 - version_conf.set('ANT_VERSION', '0.3.2.29') 99 + version_conf.set('ANT_VERSION', '0.3.2.30') 100 100 version_conf.set('ANT_GIT_HASH', git_hash) 101 101 version_conf.set('ANT_BUILD_DATE', build_date) 102 102
+10 -1
src/ant.c
··· 16424 16424 const char *str_ptr = (char *) &js->mem[str_off]; 16425 16425 const char *search_ptr = (char *) &js->mem[search_off]; 16426 16426 16427 + jsoff_t start = 0; 16428 + if (nargs >= 2) { 16429 + double pos = tod(args[1]); 16430 + if (isnan(pos) || pos < 0) pos = 0; 16431 + if (pos > str_len) return mkval(T_BOOL, 0); 16432 + start = (jsoff_t) pos; 16433 + } 16434 + 16427 16435 if (search_len == 0) return mkval(T_BOOL, 1); 16428 - for (jsoff_t i = 0; i <= str_len - search_len; i++) { 16436 + if (start + search_len > str_len) return mkval(T_BOOL, 0); 16437 + for (jsoff_t i = start; i <= str_len - search_len; i++) { 16429 16438 if (memcmp(str_ptr + i, search_ptr, search_len) == 0) { 16430 16439 return mkval(T_BOOL, 1); 16431 16440 }