Fix PR mention in gdb/gdbserver/ChangeLog's previous change.
[deliverable/binutils-gdb.git] / gdb / common / common-utils.h
CommitLineData
d26e3629
KY
1/* Shared general utility routines for GDB, the GNU debugger.
2
ecd75fc8 3 Copyright (C) 1986-2014 Free Software Foundation, Inc.
d26e3629
KY
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef COMMON_UTILS_H
21#define COMMON_UTILS_H
22
23#include "config.h"
24#include "ansidecl.h"
25#include <stddef.h>
26#include <stdarg.h>
27
28extern void malloc_failure (long size) ATTRIBUTE_NORETURN;
29extern void internal_error (const char *file, int line, const char *, ...)
30 ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 4);
31
32/* xmalloc(), xrealloc() and xcalloc() have already been declared in
33 "libiberty.h". */
34
35/* Like xmalloc, but zero the memory. */
36void *xzalloc (size_t);
37
38void xfree (void *);
39
40/* Like asprintf and vasprintf, but return the string, throw an error
41 if no memory. */
42char *xstrprintf (const char *format, ...) ATTRIBUTE_PRINTF (1, 2);
43char *xstrvprintf (const char *format, va_list ap)
44 ATTRIBUTE_PRINTF (1, 0);
45
d26e3629
KY
46/* Like snprintf, but throw an error if the output buffer is too small. */
47int xsnprintf (char *str, size_t size, const char *format, ...)
48 ATTRIBUTE_PRINTF (3, 4);
49
baea0dae
PA
50/* Make a copy of the string at PTR with LEN characters
51 (and add a null character at the end in the copy).
52 Uses malloc to get the space. Returns the address of the copy. */
53
54char *savestring (const char *ptr, size_t len);
55
d26e3629 56#endif
This page took 0.214108 seconds and 4 git commands to generate.