J
Jeff
Namely I'd like to silence this compiler warning:
util.c: In function 'substring':
util.c:50: warning: value computed is not used
util.c:51: warning: value computed is not used
But I'm open to all suggestions....
char *
substring(char *str, int start, int len)
{
int i;
char *ret;
char *res;
char *ptr;
char *end;
if ((len < 1) || (start < 0) || (start > (int)strlen (str)) || start
+len > (int)strlen(str))
return NULL;
ret = xmalloc(len+1);
res = ret;
ptr = str;
end = str;
for(i = 0; i < start; i++, *ptr++) ; /* util.c:50 */
for(i = 0; i < start+len; i++, *end++) ; /* util.c:51 */
while(ptr < end)
*res++ = *ptr++;
*res = 0;
return ret;
}
util.c: In function 'substring':
util.c:50: warning: value computed is not used
util.c:51: warning: value computed is not used
But I'm open to all suggestions....
char *
substring(char *str, int start, int len)
{
int i;
char *ret;
char *res;
char *ptr;
char *end;
if ((len < 1) || (start < 0) || (start > (int)strlen (str)) || start
+len > (int)strlen(str))
return NULL;
ret = xmalloc(len+1);
res = ret;
ptr = str;
end = str;
for(i = 0; i < start; i++, *ptr++) ; /* util.c:50 */
for(i = 0; i < start+len; i++, *end++) ; /* util.c:51 */
while(ptr < end)
*res++ = *ptr++;
*res = 0;
return ret;
}