it's wrong to use strchr(s, 0) to look for the NUL byte, because in some environments it apparently might return NULL use new macro strnul = s+strlen(s) instead (not side-effect safe tho)
This commit is contained in:
5
sh.h
5
sh.h
@@ -8,7 +8,7 @@
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.130 2007/05/13 18:33:29 tg Exp $"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.131 2007/05/13 19:14:05 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2007/05/10"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
@@ -323,6 +323,9 @@ char *ucstrstr(char *, const char *);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* use this ipv strchr(s, 0) but no side effects in s! */
|
||||
#define strnul(s) ((s) + strlen(s))
|
||||
|
||||
/*
|
||||
* Area-based allocation built on malloc/free
|
||||
*/
|
||||
|
Reference in New Issue
Block a user