Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 470884 | Differences between
and this patch

Collapse All | Expand All

(-)elfutils-0.166.orig/src/nm.c (-15 / +7 lines)
Lines 33-39 Link Here
33
#include <libdw.h>
33
#include <libdw.h>
34
#include <libintl.h>
34
#include <libintl.h>
35
#include <locale.h>
35
#include <locale.h>
36
#include <obstack.h>
37
#include <search.h>
36
#include <search.h>
38
#include <stdbool.h>
37
#include <stdbool.h>
39
#include <stdio.h>
38
#include <stdio.h>
Lines 1242-1251 show_symbols (int fd, Ebl *ebl, GElf_Ehd Link Here
1242
  size_t nentries = size / (entsize ?: 1);
1241
  size_t nentries = size / (entsize ?: 1);
1243
1242
1244
1243
1245
#define obstack_chunk_alloc xmalloc
1244
  char* whereob = NULL;
1246
#define obstack_chunk_free free
1247
  struct obstack whereob;
1248
  obstack_init (&whereob);
1249
1245
1250
  /* Get a DWARF debugging descriptor.  It's no problem if this isn't
1246
  /* Get a DWARF debugging descriptor.  It's no problem if this isn't
1251
     possible.  We just won't print any line number information.  */
1247
     possible.  We just won't print any line number information.  */
Lines 1405-1416 show_symbols (int fd, Ebl *ebl, GElf_Ehd Link Here
1405
			  const char *file = dwarf_linesrc (line, NULL, NULL);
1401
			  const char *file = dwarf_linesrc (line, NULL, NULL);
1406
			  file = (file != NULL) ? basename (file) : "???";
1402
			  file = (file != NULL) ? basename (file) : "???";
1407
			  int n;
1403
			  int n;
1408
			  n = obstack_printf (&whereob, "%s:%d%c", file,
1404
			  n = asprintf (&whereob, "%s:%d%c", file, lineno, '\0');
1409
					      lineno, '\0');
1405
			  sym_mem[nentries_used].where = whereob;
1410
			  sym_mem[nentries_used].where
1411
			    = obstack_finish (&whereob);
1412
1406
1413
			  /* The return value of obstack_print included the
1407
			  /* The return value of asprintf included the
1414
			     NUL byte, so subtract one.  */
1408
			     NUL byte, so subtract one.  */
1415
			  if (--n > (int) longest_where)
1409
			  if (--n > (int) longest_where)
1416
			    longest_where = (size_t) n;
1410
			    longest_where = (size_t) n;
Lines 1433-1445 show_symbols (int fd, Ebl *ebl, GElf_Ehd Link Here
1433
	      if (found != NULL)
1427
	      if (found != NULL)
1434
		{
1428
		{
1435
		  /* We found the line.  */
1429
		  /* We found the line.  */
1436
		  int n = obstack_printf (&whereob, "%s:%" PRIu64 "%c",
1430
		  int n = asprintf (&whereob, "%s:%" PRIu64 "%c",
1437
					  basename ((*found)->file),
1431
					  basename ((*found)->file),
1438
					  (*found)->lineno,
1432
					  (*found)->lineno,
1439
					  '\0');
1433
					  '\0');
1440
		  sym_mem[nentries_used].where = obstack_finish (&whereob);
1434
		  sym_mem[nentries_used].where = whereob;
1441
1435
1442
		  /* The return value of obstack_print included the
1436
		  /* The return value of asprintf included the
1443
		     NUL byte, so subtract one.  */
1437
		     NUL byte, so subtract one.  */
1444
		  if (--n > (int) longest_where)
1438
		  if (--n > (int) longest_where)
1445
		    longest_where = (size_t) n;
1439
		    longest_where = (size_t) n;
Lines 1491-1498 show_symbols (int fd, Ebl *ebl, GElf_Ehd Link Here
1491
  if (nentries * sizeof (sym_mem[0]) >= MAX_STACK_ALLOC)
1485
  if (nentries * sizeof (sym_mem[0]) >= MAX_STACK_ALLOC)
1492
    free (sym_mem);
1486
    free (sym_mem);
1493
1487
1494
  obstack_free (&whereob, NULL);
1495
1496
  if (dbg != NULL)
1488
  if (dbg != NULL)
1497
    {
1489
    {
1498
      tdestroy (global_root, free);
1490
      tdestroy (global_root, free);

Return to bug 470884