source: bootcd/isolinux/syslinux-6.03/com32/include/refstr.h

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2008 H. Peter Anvin - All Rights Reserved
4 *
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.
10 *
11 * ----------------------------------------------------------------------- */
12
13/*
14 * refstr.h
15 *
16 * Simple reference-counted strings
17 */
18
19#ifndef REFSTR_H
20#define REFSTR_H
21
22#include <stddef.h>
23#include <stdarg.h>
24
25static inline __attribute__ ((always_inline))
26const char *refstr_get(const char *r)
27{
28    if (r)
29        ((unsigned int *)r)[-1]++;
30    return r;
31}
32
33void refstr_put(const char *);
34char *refstr_alloc(size_t);
35const char *refstrdup(const char *);
36const char *refstrndup(const char *, size_t);
37int rsprintf(const char **, const char *, ...);
38int vrsprintf(const char **, const char *, va_list);
39
40#endif
Note: See TracBrowser for help on using the repository browser.