~ubuntu-branches/ubuntu/vivid/cproto/vivid-proposed

« back to all changes in this revision

Viewing changes to symbol.c

  • Committer: Bazaar Package Importer
  • Author(s): Kenneth J. Pronovici
  • Date: 2004-03-30 19:58:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040330195833-loh9sgce2as79j67
Tags: 4.7c-1
* New upstream release.
  - Includes equivalent of patch as used to close #228801 (see below).
  - Supports -X option to filter out unwanted definitions (closes: #235824).
* Now configure using --enable-llib option, so we don't need lint installed.
* Added gcc to Depends: line since -X option requires GCC to work; I assume
  most users will already have gcc installed anyway, if they are developers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: symbol.c,v 4.3 1998/01/19 00:49:30 cthuang Exp $
 
1
/* $Id: symbol.c,v 4.3.1.1 2004/03/24 20:58:35 tom Exp tom $
2
2
 *
3
3
 * Implements a symbol table abstract data type.
4
4
 */
6
6
#include "cproto.h"
7
7
#include "symbol.h"
8
8
 
9
 
static unsigned hash ARGS((char *name));
10
 
static Symbol *search_symbol_list ARGS((Symbol *list, char *name));
11
 
 
12
9
/* Create a symbol table.
13
10
 * Return a pointer to the symbol table or NULL if an error occurs.
14
11
 */
15
12
SymbolTable *
16
 
new_symbol_table ()
 
13
new_symbol_table (void)
17
14
{
18
15
    SymbolTable *symtab;
19
16
    int i;
29
26
/* Free the memory allocated to the symbol table.
30
27
 */
31
28
void
32
 
free_symbol_table (symtab)
33
 
SymbolTable *symtab;
 
29
free_symbol_table (SymbolTable *symtab)
34
30
{
35
31
    int i;
36
32
    Symbol *sym, *next;
52
48
/* This is a simple hash function mapping a symbol name to a hash bucket. */
53
49
 
54
50
static unsigned
55
 
hash (name)
56
 
char *name;
 
51
hash (char *name)
57
52
{
58
53
    char *s;
59
54
    unsigned h;
70
65
 * Return a pointer to the symbol or NULL if not found.
71
66
 */
72
67
static Symbol *
73
 
search_symbol_list (list, name)
74
 
Symbol *list;
75
 
char *name;
 
68
search_symbol_list (Symbol *list, char *name)
76
69
{
77
70
    Symbol *sym;
78
71
 
88
81
 * Return a pointer to the symbol or NULL if not found.
89
82
 */
90
83
Symbol *
91
 
find_symbol (symtab, name)
92
 
SymbolTable *symtab;
93
 
char *name;
 
84
find_symbol (SymbolTable *symtab, char *name)
94
85
{
95
86
    return search_symbol_list(symtab->bucket[hash(name)], name);
96
87
}
101
92
 * Return a pointer to the symbol.
102
93
 */
103
94
Symbol *
104
 
new_symbol (symtab, name, value, flags)
105
 
SymbolTable *symtab;    /* symbol table */
106
 
char *name;             /* symbol name */
107
 
char *value;            /* symbol value */
108
 
int flags;              /* symbol attributes */
 
95
new_symbol (
 
96
SymbolTable *symtab,    /* symbol table */
 
97
char *name,             /* symbol name */
 
98
char *value,            /* symbol value */
 
99
int flags)              /* symbol attributes */
109
100
{
110
101
    Symbol *sym;
111
102
    int i;