[Mesa-dev] [PATCH mesa 08/13] util: use standard name for strchr()
Eric Engestrom
eric.engestrom at intel.com
Tue Nov 20 13:11:08 UTC 2018
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
src/util/u_debug.c | 2 +-
src/util/u_string.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/u_debug.c b/src/util/u_debug.c
index fde2d60406572fbcf64b..adf62ae9b4a6153c2a2c 100644
--- a/src/util/u_debug.c
+++ b/src/util/u_debug.c
@@ -55,7 +55,7 @@ _debug_vprintf(const char *format, va_list ap)
/* We buffer until we find a newline. */
size_t len = strlen(buf);
int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
- if (ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) {
+ if (ret > (int)(sizeof(buf) - len - 1) || strchr(buf + len, '\n')) {
os_log_message(buf);
buf[0] = '\0';
}
diff --git a/src/util/u_string.h b/src/util/u_string.h
index f46a7d8e3e4307c19e51..5039f4ba02569f867f81 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -131,6 +131,7 @@ util_vasprintf(char **ret, const char *format, va_list ap)
return util_vsnprintf(*ret, r + 1, format, ap);
}
+#define strchr util_strchr
static inline char *
util_strchr(const char *s, char c)
{
@@ -195,7 +196,7 @@ util_strstr(const char *haystack, const char *needle)
const char *p = haystack;
size_t len = strlen(needle);
- for (; (p = util_strchr(p, *needle)) != 0; p++) {
+ for (; (p = strchr(p, *needle)) != 0; p++) {
if (strncmp(p, needle, len) == 0) {
return (char *)p;
}
@@ -214,7 +215,6 @@ util_strstr(const char *haystack, const char *needle)
#define util_vsprintf vsprintf
#define util_vasprintf vasprintf
#define util_sprintf sprintf
-#define util_strchr strchr
#endif
--
Cheers,
Eric
More information about the mesa-dev
mailing list