summaryrefslogtreecommitdiff
path: root/include/m_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/m_string.h')
-rw-r--r--include/m_string.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/m_string.h b/include/m_string.h
index 9efa0376942..1f59fd06084 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -108,6 +108,15 @@ extern char *strcend(const char *, pchar);
extern char *strfill(char * s,size_t len,pchar fill);
extern char *strmake(char *dst,const char *src,size_t length);
+#if !defined(__GNUC__) || (__GNUC__ < 4)
+#define strmake_buf(D,S) strmake(D, S, sizeof(D) - 1)
+#else
+#define strmake_buf(D,S) ({ \
+ compile_time_assert(sizeof(D) != sizeof(char*)); \
+ strmake(D, S, sizeof(D) - 1); \
+ })
+#endif
+
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#endif