Exemplo n.º 1
0
void unsafemap_rbtree_sub ( RBNODE node, void (*mapfun)(RBNODE) ){
	if (NULL!=node){
		mapfun(node);
		unsafemap_rbtree_sub(node->left,mapfun);
		unsafemap_rbtree_sub(node->right,mapfun);
	}
}
Exemplo n.º 2
0
void map_rbtree_sub ( RBNODE node, void * (*mapfun)(const void *, void *) ){
	if (NULL!=node){
		node->value = mapfun(node->key,node->value);
		map_rbtree_sub(node->left,mapfun);
		map_rbtree_sub(node->right,mapfun);
	}
}
Exemplo n.º 3
0
Arquivo: jsscan.c Projeto: artcom/y60
js_MapKeywords(void (*mapfun)(const char *))
{
    struct keyword *kw;

    for (kw = keywords; kw->name; kw++)
        mapfun(kw->name);
}
Exemplo n.º 4
0
void
hash_table_map (struct hash_table *ht,
		int (*mapfun) (void *, void *, void *),
		void *closure)
{
  struct mapping *mp  = ht->mappings;
  struct mapping *end = ht->mappings + ht->size;

  for (; mp < end; mp++)
    if (!EMPTY_MAPPING_P (mp))
      {
	void *key;
      repeat:
	key = mp->key;
	if (mapfun (key, mp->value, closure))
	  return;
	/* hash_table_remove might have moved the adjacent
	   mappings. */
	if (mp->key != key && !EMPTY_MAPPING_P (mp))
	  goto repeat;
      }
}
Exemplo n.º 5
0
extern void map_files(lua_State *L, const char *dirpath, void (*mapfun)(lua_State *, const char *))
{
    DIR *handle;
    struct dirent *d;
    int firsterror;

    if (!(handle = opendir(dirpath)))
        goto done;
    for (;;) {
        errno = 0;
        if (!(d = readdir(handle)))
            break;
        if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
            continue;
        mapfun(L, d->d_name);
    }
done:
    firsterror = errno;
    if (handle && (closedir(handle) == -1) && !firsterror)
        firsterror = errno;
    if (firsterror)
        luaL_error(L, "cannot list directory %s: %s",
                   dirpath, strerror(firsterror));
}