tools/elf4rom/libs/dwarf-20071209/dwarfdump/makename.c
changeset 34 92d87f2e53c2
equal deleted inserted replaced
33:1af5c1be89f8 34:92d87f2e53c2
       
     1 
       
     2 /* 
       
     3   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
       
     4 
       
     5   This program is free software; you can redistribute it and/or modify it
       
     6   under the terms of version 2 of the GNU General Public License as
       
     7   published by the Free Software Foundation.
       
     8 
       
     9   This program is distributed in the hope that it would be useful, but
       
    10   WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       
    12 
       
    13   Further, this software is distributed without any warranty that it is
       
    14   free of the rightful claim of any third person regarding infringement
       
    15   or the like.  Any license provided herein, whether implied or
       
    16   otherwise, applies only to this software file.  Patent licenses, if
       
    17   any, provided herein do not apply to combinations of this program with
       
    18   other software, or any other product whatsoever.
       
    19 
       
    20   You should have received a copy of the GNU General Public License along
       
    21   with this program; if not, write the Free Software Foundation, Inc., 51
       
    22   Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
       
    23 
       
    24   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
       
    25   Mountain View, CA 94043, or:
       
    26 
       
    27   http://www.sgi.com
       
    28 
       
    29   For further information regarding this notice, see:
       
    30 
       
    31   http://oss.sgi.com/projects/GenInfo/NoticeExplan
       
    32 
       
    33    makename.c
       
    34    $Revision: 1.4 $ 
       
    35    $Date: 2005/11/08 21:48:42 $
       
    36 
       
    37    This used to be elaborate stuff.
       
    38    Now it is trivial, as duplicating names is
       
    39    unimportant in dwarfdump (in general).
       
    40 
       
    41    And in fact, this is only called for attributes and
       
    42    tags etc whose true name is unknown. Not for
       
    43    any normal case.
       
    44 
       
    45 */
       
    46 
       
    47 #include <stdio.h>
       
    48 #include <string.h>
       
    49 #include <stdlib.h>
       
    50 #include "makename.h"
       
    51 
       
    52 char *
       
    53 makename(char *s)
       
    54 {
       
    55     char *newstr;
       
    56 
       
    57     if (!s) {
       
    58 	return "";
       
    59     }
       
    60 
       
    61     newstr = strdup(s);
       
    62     if (newstr == 0) {
       
    63 	fprintf(stderr, "Out of memory mallocing %d bytes\n",
       
    64 		(int) strlen(s));
       
    65 	exit(1);
       
    66     }
       
    67     return newstr;
       
    68 }