Define empty for gcc 2.95.

2004-11-29  Matthias Clasen  <mclasen@redhat.com>

	* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.

	* glib/gmarkup.c (unescape_text_state_after_charref_hash):
	Avoid a strndup() here, noticed by Morten Welinder.
This commit is contained in:
Matthias Clasen 2004-11-29 14:50:47 +00:00 committed by Matthias Clasen
parent 18651f45d0
commit 8f0d5d169e
7 changed files with 64 additions and 25 deletions

View File

@ -1,3 +1,10 @@
2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.
* glib/gmarkup.c (unescape_text_state_after_charref_hash):
Avoid a strndup() here, noticed by Morten Welinder.
2004-11-29 Matthias Clasen <mclasen@redhat.com> 2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c: Remove leftover noinline attributes. * glib/gmarkup.c: Remove leftover noinline attributes.

View File

@ -1,3 +1,10 @@
2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.
* glib/gmarkup.c (unescape_text_state_after_charref_hash):
Avoid a strndup() here, noticed by Morten Welinder.
2004-11-29 Matthias Clasen <mclasen@redhat.com> 2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c: Remove leftover noinline attributes. * glib/gmarkup.c: Remove leftover noinline attributes.

View File

@ -1,3 +1,10 @@
2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.
* glib/gmarkup.c (unescape_text_state_after_charref_hash):
Avoid a strndup() here, noticed by Morten Welinder.
2004-11-29 Matthias Clasen <mclasen@redhat.com> 2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c: Remove leftover noinline attributes. * glib/gmarkup.c: Remove leftover noinline attributes.

View File

@ -1,3 +1,10 @@
2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.
* glib/gmarkup.c (unescape_text_state_after_charref_hash):
Avoid a strndup() here, noticed by Morten Welinder.
2004-11-29 Matthias Clasen <mclasen@redhat.com> 2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c: Remove leftover noinline attributes. * glib/gmarkup.c: Remove leftover noinline attributes.

View File

@ -1,3 +1,10 @@
2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h (G_GNUC_MALLOC): Define empty for gcc 2.95.
* glib/gmarkup.c (unescape_text_state_after_charref_hash):
Avoid a strndup() here, noticed by Morten Welinder.
2004-11-29 Matthias Clasen <mclasen@redhat.com> 2004-11-29 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c: Remove leftover noinline attributes. * glib/gmarkup.c: Remove leftover noinline attributes.

View File

@ -50,8 +50,11 @@
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
#define G_GNUC_PURE \ #define G_GNUC_PURE \
__attribute__((__pure__)) __attribute__((__pure__))
#define G_GNUC_MALLOC \
__attribute__((__malloc__))
#else #else
#define G_GNUC_PURE #define G_GNUC_PURE
#define G_GNUC_MALLOC
#endif #endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
@ -69,8 +72,6 @@
__attribute__((__unused__)) __attribute__((__unused__))
#define G_GNUC_NO_INSTRUMENT \ #define G_GNUC_NO_INSTRUMENT \
__attribute__((__no_instrument_function__)) __attribute__((__no_instrument_function__))
#define G_GNUC_MALLOC \
__attribute__((__malloc__))
#else /* !__GNUC__ */ #else /* !__GNUC__ */
#define G_GNUC_PRINTF( format_idx, arg_idx ) #define G_GNUC_PRINTF( format_idx, arg_idx )
#define G_GNUC_SCANF( format_idx, arg_idx ) #define G_GNUC_SCANF( format_idx, arg_idx )
@ -79,7 +80,6 @@
#define G_GNUC_CONST #define G_GNUC_CONST
#define G_GNUC_UNUSED #define G_GNUC_UNUSED
#define G_GNUC_NO_INSTRUMENT #define G_GNUC_NO_INSTRUMENT
#define G_GNUC_MALLOC
#endif /* !__GNUC__ */ #endif /* !__GNUC__ */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)

View File

@ -278,7 +278,7 @@ static gchar*
char_str (gunichar c, char_str (gunichar c,
gchar *buf) gchar *buf)
{ {
memset (buf, 0, 7); memset (buf, 0, 8);
g_unichar_to_utf8 (c, buf); g_unichar_to_utf8 (c, buf);
return buf; return buf;
} }
@ -430,7 +430,7 @@ unescape_text_state_after_ampersand (UnescapeContext *ucontext,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_unescape_error (ucontext->context, error, set_unescape_error (ucontext->context, error,
p, ucontext->text_end, p, ucontext->text_end,
@ -470,7 +470,7 @@ unescape_text_state_inside_entity_name (UnescapeContext *ucontext,
break; break;
else if (!is_name_char (p)) else if (!is_name_char (p))
{ {
gchar ubuf[7]; gchar ubuf[8];
set_unescape_error (ucontext->context, error, set_unescape_error (ucontext->context, error,
p, ucontext->text_end, p, ucontext->text_end,
@ -567,28 +567,26 @@ unescape_text_state_after_charref_hash (UnescapeContext *ucontext,
if (start != p) if (start != p)
{ {
gchar *digit = g_strndup (start, p - start);
gulong l; gulong l;
gchar *end = NULL; gchar *end = NULL;
gchar *digit_end = digit + (p - start);
errno = 0; errno = 0;
if (is_hex) if (is_hex)
l = strtoul (digit, &end, 16); l = strtoul (start, &end, 16);
else else
l = strtoul (digit, &end, 10); l = strtoul (start, &end, 10);
if (end != digit_end || errno != 0) if (end != p || errno != 0)
{ {
set_unescape_error (ucontext->context, error, set_unescape_error (ucontext->context, error,
start, ucontext->text_end, start, ucontext->text_end,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
_("Failed to parse '%s', which " _("Failed to parse '%-.*s', which "
"should have been a digit " "should have been a digit "
"inside a character reference " "inside a character reference "
"(&#234; for example) - perhaps " "(&#234; for example) - perhaps "
"the digit is too large"), "the digit is too large"),
digit); p - start, start);
} }
else else
{ {
@ -600,7 +598,7 @@ unescape_text_state_after_charref_hash (UnescapeContext *ucontext,
(l >= 0xE000 && l <= 0xFFFD) || (l >= 0xE000 && l <= 0xFFFD) ||
(l >= 0x10000 && l <= 0x10FFFF)) (l >= 0x10000 && l <= 0x10FFFF))
{ {
gchar buf[7]; gchar buf[8];
g_string_append (ucontext->str, char_str (l, buf)); g_string_append (ucontext->str, char_str (l, buf));
} }
else else
@ -608,13 +606,12 @@ unescape_text_state_after_charref_hash (UnescapeContext *ucontext,
set_unescape_error (ucontext->context, error, set_unescape_error (ucontext->context, error,
start, ucontext->text_end, start, ucontext->text_end,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
_("Character reference '%s' does not encode a permitted character"), _("Character reference '%-.*s' does not "
digit); "encode a permitted character"),
p - start, start);
} }
} }
g_free (digit);
/* Move to next state */ /* Move to next state */
p = g_utf8_next_char (p); /* past semicolon */ p = g_utf8_next_char (p); /* past semicolon */
ucontext->state = USTATE_INSIDE_TEXT; ucontext->state = USTATE_INSIDE_TEXT;
@ -1099,7 +1096,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1162,7 +1160,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1250,7 +1249,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1291,7 +1291,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1379,7 +1380,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1523,7 +1525,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
} }
else else
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
@ -1562,7 +1565,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
if (*context->iter != '>') if (*context->iter != '>')
{ {
gchar buf[7]; gchar buf[8];
set_error (context, set_error (context,
error, error,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,