Changeset 141 for trunk/src


Ignore:
Timestamp:
May 19, 2008, 8:25:25 AM (11 years ago)
Author:
cameron
Message:

Eliminate excess name copying.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/byteplex.h

    r133 r141  
    6060
    6161/* Define the size of buffer used for lexical analysis/parsing. */
    62 const int BUFFER_BLOCKS = 781;
     62const int BUFFER_BLOCKS = 78;
    6363const int BUFFER_SIZE = BUFFER_BLOCKS * BLOCKSIZE;
    6464
  • trunk/src/symtab.c

    r139 r141  
    192192}
    193193
     194int Symbol_Table::Insert_Name(char * name, int lgth) {
     195        char * s = copy_name(name,lgth);
     196        UTF8NameMap[s]=++(globalNameCount);
     197        Name_Data name_data;
     198        name_data.name_string = s;
     199        name_data.lgth = lgth;
     200        UTF8NameTable.push_back(name_data);
     201        return globalNameCount;
     202}
     203
    194204int Symbol_Table::UTF8_Lookup_or_Insert_XML10_Name(char * name, int lgth) {
    195         char * s = copy_name(name,lgth);
    196         int nameID = UTF8NameMap[s];
    197         if(nameID == 0){
     205        char delim = name[lgth];
     206        name[lgth] = '\0';
     207        int nameID = UTF8NameMap[name];
     208        name[lgth] = delim;     
     209        if (nameID == 0){
    198210                if (!is_XML10_UTF8_Name(name,lgth)) {
    199211                        ShowSyntaxError(NT_Name);
    200212                        exit(-1);
    201213                }
     214                char * s = copy_name(name,lgth);
    202215                UTF8NameMap[s]=++(globalNameCount);
    203216                nameID = globalNameCount;
  • trunk/src/symtab.h

    r139 r141  
    3030public:
    3131        Symbol_Table();
     32        int Insert_Name(char * name, int lgth);
    3233        int UTF8_Lookup_or_Insert_XML10_Name(char * name, int lgth);
    3334        int UTF8_Lookup_or_Insert_XML11_Name(char * name, int lgth);
  • trunk/src/xmlmodel.c

    r135 r141  
    1212void Model_Info::SimpleEntity(char * entity_Name, char * replText) {
    1313               
    14                 int entity_NameID = symbol_table->UTF8_Lookup_or_Insert_XML10_Name(entity_Name, strlen(entity_Name));
     14                int entity_NameID = symbol_table->Insert_Name(entity_Name, strlen(entity_Name));
    1515                int entityID = GlobalGEntityTable[entity_NameID];
    1616                if(entityID==0){       
Note: See TracChangeset for help on using the changeset viewer.