Adding upstream version 4.00~pre61+dfsg.
[syslinux-debian/hramrach.git] / com32 / menu / refstr.h
blob7001d40759a17d28f954edd9a2b829e1791cfac1
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
14 * refstr.h
16 * Simple reference-counted strings
19 #ifndef REFSTR_H
20 #define REFSTR_H
22 #include <stddef.h>
23 #include <stdarg.h>
25 static inline __attribute__ ((always_inline))
26 const char *refstr_get(const char *r)
28 if (r)
29 ((unsigned int *)r)[-1]++;
30 return r;
33 void refstr_put(const char *);
34 char *refstr_alloc(size_t);
35 const char *refstrdup(const char *);
36 const char *refstrndup(const char *, size_t);
37 int rsprintf(const char **, const char *, ...);
38 int vrsprintf(const char **, const char *, va_list);
40 #endif