From 053d7e775c3b369debbb71e26244fc4c76688f48 Mon Sep 17 00:00:00 2001 From: Murthy Narkedimilli Date: Mon, 25 Feb 2013 15:26:00 +0100 Subject: Updated/added copyright headers. --- include/m_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/m_string.h') diff --git a/include/m_string.h b/include/m_string.h index dc916792f60..08738c9e482 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 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 -- cgit v1.2.1 From 07315d36030bd1cbe6acfeb3e8f60c49ba876a10 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 17 Apr 2013 19:42:34 +0200 Subject: strmake_buf(X,Y) helper, equivalent to strmake(X,Y,sizeof(X)-1) with a bit of lame protection against abuse. --- include/m_string.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/m_string.h') diff --git a/include/m_string.h b/include/m_string.h index 9efa0376942..990f78eb555 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -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 -- cgit v1.2.1