/[escript]/trunk/escript/src/blocktimer.c
ViewVC logotype

Diff of /trunk/escript/src/blocktimer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1636 by phornby, Sat Jul 12 09:08:33 2008 UTC revision 1637 by ksteube, Mon Jul 14 05:34:59 2008 UTC
# Line 74  int Line 74  int
74  blocktimer_getOrCreateTimerId(__const char *name)  blocktimer_getOrCreateTimerId(__const char *name)
75  {  {
76    int id=0;    int id=0;
77      char *tmp_str;
78  #ifdef BLOCKTIMER  #ifdef BLOCKTIMER
79    static int nextId = 0;        /* Next timer ID to assign */    static int nextId = 0;        /* Next timer ID to assign */
80    ENTRY item, *found_item;    ENTRY item, *found_item;
# Line 81  blocktimer_getOrCreateTimerId(__const ch Line 82  blocktimer_getOrCreateTimerId(__const ch
82    if (!g_initialized) { return(0); }    if (!g_initialized) { return(0); }
83    
84    /* Has a timer with 'name' already been defined? */    /* Has a timer with 'name' already been defined? */
85    item.key = name;    item.key = (char *)name;
86    item.data = (void *) NULL;    item.data = (void *) NULL;
87    found_item = hsearch(item, FIND);    found_item = hsearch(item, FIND);
88    
# Line 99  blocktimer_getOrCreateTimerId(__const ch Line 100  blocktimer_getOrCreateTimerId(__const ch
100        exit(1);        exit(1);
101      }      }
102      *idTmp = nextId++;      *idTmp = nextId++;
103      item.key = name;      item.key = (char *)name;
104      item.data = (void *) idTmp;      item.data = (void *) idTmp;
105      hsearch(item, ENTER);      hsearch(item, ENTER);
106      id = *idTmp;      id = *idTmp;
107      g_names[id] = (char *)strdup(name);      /* Make a copy of the name and save with other names */
108        tmp_str = malloc(strlen(name)+1);
109        strcpy(tmp_str, name);
110        g_names[id] = tmp_str;
111    }    }
112    
113  #endif /* BLOCKTIMER */  #endif /* BLOCKTIMER */

Legend:
Removed from v.1636  
changed lines
  Added in v.1637

  ViewVC Help
Powered by ViewVC 1.1.26