tzwrapper.cc: fixed use of iterator after erase
[barry.git] / src / strnlen.h
blob782ce6eac86c56af468f5c2ee06457c49e2fb281
1 ///
2 /// \file strnlen.h
3 /// Header for strnlen() call, for systems that don't have GNU.
4 ///
6 /*
7 Copyright (C) 2007-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_STRNLEN_H__
23 #define __BARRY_STRNLEN_H__
25 #include "config.h" // strnlen.h is not installed, so this is safe
26 #include <string.h>
28 #if defined(WIN32) && !defined(WINCE)
29 #define HAVE_WORKING_STRNLEN 1
30 #endif
32 // this is always defined by configure, if not, then the autoconf
33 // sources changed (likely in /usr/share/autoconf/autoconf/functions.m4)
34 // and configure.ac is no longer accurate
35 #ifndef HAVE_WORKING_STRNLEN
36 #error Configure.ac is not accurate. Read comments in strnlen.h.
37 #endif
39 // now, if defined and set to 0, then strnlen() either does not exist at all,
40 // or is broken (on AIX)
41 #if !HAVE_WORKING_STRNLEN
43 // so define our own version...
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
48 size_t barry_strnlen(const char *s, size_t maxlen);
50 #ifdef __cplusplus
52 #endif
54 // and override the system's name so we call our own
55 #define strnlen(s,l) barry_strnlen(s,l)
57 #endif // !HAVE_WORKING_STRNLEN
59 #endif // __BARRY_STRNLEN_H__