示例#1
0
char *factoid_get(array *args, struct irc_message *msg) {
	const char *value;

	if (array_count(args) < 1) return NULL;
	value = strmap_find(&factoids, *(char**)array_at(args, 0));
	if (value == NULL) return NULL;
	return new_string(value);
}
示例#2
0
/*
 * Remove record r
 */
void strmap_erase(strmap_t *hmap, strmap_rec_t *r) {
  assert(strmap_find(hmap, r->key) == r);

  string_decref(r->key);
  r->key = DELETED_KEY;
  hmap->nelems --;
  hmap->ndeleted ++;
  if (hmap->ndeleted > hmap->cleanup_threshold) {
    strmap_cleanup(hmap);
  }
}
示例#3
0
文件: parse.c 项目: SrTobi/fakeasm
void push_label(const char* name)
{
    Function* curf = cur_func();
    
    // check if label already exists
    Label** foundl = strmap_find(curf->labels, name);
    if(foundl != NULL)
        yyerrerf("A label with the name '%s' has already been defined in function '%s'.", name, curf->name);
    
    /*llist_foreach(LabelList, curf->labels, l)
    {
        if(strcmp(l->name, name) == 0)
        {
            
        }
    }*/    
    
    Label* l = new_label(name);
    curlabels = llist_prepend(l, curlabels);
    
    strmap_insert(curf->labels, name, l);
    //curf->labels = llist_prepend(l, curf->labels);
}