summaryrefslogtreecommitdiffstats
path: root/gl/printf-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/printf-parse.c')
-rw-r--r--gl/printf-parse.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gl/printf-parse.c b/gl/printf-parse.c
index 79b35034..34d241a6 100644
--- a/gl/printf-parse.c
+++ b/gl/printf-parse.c
@@ -1,5 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 1999-2000, 2002-2003, 2006-2025 Free Software Foundation, Inc. 2 Copyright (C) 1999-2000, 2002-2003, 2006-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -323,8 +323,6 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
323 } 323 }
324 324
325 { 325 {
326 arg_type type;
327
328 /* Parse argument type/size specifiers. */ 326 /* Parse argument type/size specifiers. */
329 /* Relevant for the conversion characters d, i. */ 327 /* Relevant for the conversion characters d, i. */
330 arg_type signed_type = TYPE_INT; 328 arg_type signed_type = TYPE_INT;
@@ -561,6 +559,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
561 (void) pointer_type; 559 (void) pointer_type;
562 560
563 /* Read the conversion character. */ 561 /* Read the conversion character. */
562 arg_type type;
564 c = *cp++; 563 c = *cp++;
565 switch (c) 564 switch (c)
566 { 565 {
@@ -654,17 +653,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
654 d->count++; 653 d->count++;
655 if (d->count >= d_allocated) 654 if (d->count >= d_allocated)
656 { 655 {
657 size_t memory_size;
658 DIRECTIVE *memory;
659
660 d_allocated = xtimes (d_allocated, 2); 656 d_allocated = xtimes (d_allocated, 2);
661 memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); 657 size_t memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
662 if (size_overflow_p (memory_size)) 658 if (size_overflow_p (memory_size))
663 /* Overflow, would lead to out of memory. */ 659 /* Overflow, would lead to out of memory. */
664 goto out_of_memory; 660 goto out_of_memory;
665 memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir 661 DIRECTIVE *memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir
666 ? realloc (d->dir, memory_size) 662 ? realloc (d->dir, memory_size)
667 : malloc (memory_size)); 663 : malloc (memory_size));
668 if (memory == NULL) 664 if (memory == NULL)
669 /* Out of memory. */ 665 /* Out of memory. */
670 goto out_of_memory; 666 goto out_of_memory;