Exemple #1
0
/*
 * Map all of the aliased users in the invoker's mailrc
 * file and insert them into the list.
 * Changed after all these months of service to recursively
 * expand names (2/14/80).
 * And changed after all these years to weed out state.var.user
 * in one place (8/11/96).
 */
static int
mapuser(Dt_t* dt, void* object, void* context)
{
	register struct name*	np = (struct name*)object;
	register Walk_map_t*	wm = (Walk_map_t*)context;
	struct name*		ap;
	struct list*		mp;
	char*			s;

	if (np->flags & GDONE)
		return 0;
	if (!(np->flags & GMAP)) {
		np->flags |= GMAP;
		dictsearch(&wm->seen, np->name, INSERT|IGNORECASE|STACK);
		if (*np->name != '\\' && (ap = dictsearch(&state.aliases, np->name, LOOKUP))) {
			for (mp = (struct list*)ap->value; mp; mp = mp->next)
				mapadd(wm, np, mp->name, np->flags & ~(GMAP|GMETOO));
			return 0;
		}
		if (s = normalize(np->name, GCOMPARE, state.path.path, sizeof(state.path.path))) {
			mapadd(wm, np, s, np->flags & ~GMAP);
			return 0;
		}
		if (!(np->flags & GMETOO) && !state.var.metoo && streq(np->name, state.var.user) && (np->flags & (GCC|GBCC))) {
			if (wm->show)
				note(0, "\"%s\" -> DELETE", np->name);
			return 0;
		}
	}
	if (!dictsearch(&state.aliases, np->name, LOOKUP))
		dictsearch(&wm->next, (char*)np, INSERT|IGNORECASE|STACK|OBJECT|COPY);
	return 0;
}
Exemple #2
0
void *n64_malloc(size_t size_to_alloc)
{
    if (0 == kv_set)
    {
        kv_set = new_kv(1024);
    }

    int adjusted_size = size_to_alloc;

    if (size_to_alloc < 8)
    {
        adjusted_size = 8;
    }

    else if (size_to_alloc % 8 != 0)
    {
        adjusted_size += (8 - (size_to_alloc % 8));
    }

    void *buf = malloc(adjusted_size);

    if (0 != buf)
    {
        allocated_bytes += adjusted_size;
    }

    // map address to size and store somewhere
    mapadd(kv_set, ((uint32_t)&buf)&0x0FFFFFFF, adjusted_size);

    return buf;
}