mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-20 10:43:29 +00:00
[ruamoko] Fix daft str_str abi
Returning a string was a bad idea as it makes str_str difficult to use with str_mid. (actually, iirc, it was the only reason I moved all strings into progs memory... hmm).
This commit is contained in:
parent
b7b8df0801
commit
54f2e417dc
4 changed files with 7 additions and 6 deletions
|
@ -192,9 +192,10 @@ bi_str_str (progs_t *pr)
|
|||
const char *needle = P_GSTRING (pr, 1);
|
||||
char *res = strstr (haystack, needle);
|
||||
|
||||
R_STRING (pr) = 0;
|
||||
if (res)
|
||||
R_STRING (pr) = res - pr->pr_strings;
|
||||
R_INT (pr) = -1;
|
||||
if (res) {
|
||||
R_INT (pr) = res - haystack;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -81,7 +81,7 @@ class_from_plist (PLDictionary *pldict)
|
|||
break;
|
||||
case "0": case "1": case "2": case "3": case "4":
|
||||
case "5": case "6": case "7": case "8": case "9":
|
||||
if (str_str (paramstr, "."))
|
||||
if (str_str (paramstr, ".") >= 0)
|
||||
va_list.list[j].float_val = stof (paramstr);
|
||||
else
|
||||
va_list.list[j].integer_val = stoi (paramstr);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
@extern string str_clear (string str);
|
||||
@extern @overload string str_mid (string str, int start);
|
||||
@extern @overload string str_mid (string str, int start, int len);
|
||||
@extern string str_str (string haystack, string needle);
|
||||
int str_str (string haystack, string needle);
|
||||
@extern int str_char (string str, int ind);
|
||||
string str_quote (string str);
|
||||
string str_lower (string str);
|
||||
|
|
|
@ -13,7 +13,7 @@ string (string dst, string src) str_cat = #0;
|
|||
string (string str) str_clear = #0;
|
||||
string (string str, int start) str_mid = #0;
|
||||
string (string str, int start, int len) str_mid = #0;
|
||||
string (string haystack, string needle) str_str = #0;
|
||||
int str_str (string haystack, string needle) = #0;
|
||||
int str_char (string str, int ind) = #0;
|
||||
string str_quote (string str) = #0;
|
||||
string str_lower (string str) = #0;
|
||||
|
|
Loading…
Reference in a new issue