Qball's Weblog
Puzzled
Why is my code broken because vala developers decided that the string.str is something you don’t need and is deprecated.
Instead you need to use index_of function.
So now if I want to get a pointer (c) to substring b in string a, this is done (merged the c code inserted by vala):
1 2 3 4 5 6 7 8 9 10 11 12 |
char *temp = strstr(a,b); int index; char *c = NULL; if(temp == NULL) index = -1; else index = (temp-a); if(index >= ) { c = &a[index]; } |
(p.s. I removed the extra function call this also causes)
instead of the old way:
1 |
char*c = strstr(a,b); |
Is this realy worth