projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fflush: Fix syntax error.
[gnulib.git]
/
lib
/
obstack_printf.c
diff --git
a/lib/obstack_printf.c
b/lib/obstack_printf.c
index
f546f00
..
b9f06d6
100644
(file)
--- a/
lib/obstack_printf.c
+++ b/
lib/obstack_printf.c
@@
-1,5
+1,5
@@
/* Formatted output to obstacks.
/* Formatted output to obstacks.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008
-2012
Free Software Foundation, Inc.
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
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
@@
-12,8
+12,7
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <config.h>
@@
-58,22
+57,22
@@
obstack_vprintf (struct obstack *obs, const char *format, va_list args)
stack-allocated buffer and copy, to reduce the likelihood of a
small-size malloc. Otherwise, print directly into the
obstack. */
stack-allocated buffer and copy, to reduce the likelihood of a
small-size malloc. Otherwise, print directly into the
obstack. */
-
const size_t cutoff = 1024
;
- char buf[
cutoff
];
+
enum { CUTOFF = 1024 }
;
+ char buf[
CUTOFF
];
char *base = obstack_next_free (obs);
size_t len = obstack_room (obs);
char *str;
char *base = obstack_next_free (obs);
size_t len = obstack_room (obs);
char *str;
- if (len <
cutoff
)
+ if (len <
CUTOFF
)
{
base = buf;
{
base = buf;
- len =
cutoff
;
+ len =
CUTOFF
;
}
str = vasnprintf (base, &len, format, args);
if (!str)
{
if (errno == ENOMEM)
}
str = vasnprintf (base, &len, format, args);
if (!str)
{
if (errno == ENOMEM)
- obstack_alloc_failed_handler ();
+
obstack_alloc_failed_handler ();
return -1;
}
if (str == base && str != buf)
return -1;
}
if (str == base && str != buf)
@@
-83,10
+82,10
@@
obstack_vprintf (struct obstack *obs, const char *format, va_list args)
else
{
/* The output exceeded available obstack space or we used buf;
else
{
/* The output exceeded available obstack space or we used buf;
- copy the resulting string. */
+
copy the resulting string. */
obstack_grow (obs, str, len);
if (str != buf)
obstack_grow (obs, str, len);
if (str != buf)
- free (str);
+
free (str);
}
return len;
}
}
return len;
}