Søg

3 thing about me

Kopier dette storyboard
3 thing about me

Storyboard Tekst

  • coeding
  • static void usage(void){ fprintf(stderr, "Usage: fixdep depfile target cmdline\n"); exit(1);}struct item { struct item *next; unsigned int len; unsigned int hash; char name[];};#define HASHSZ 256static struct item *config_hashtab[HASHSZ], *file_hashtab[HASHSZ];static unsigned int strhash(const char *str, unsigned int sz){ /* fnv32 hash */ unsigned int i, hash = 2166136261U; for (i = 0; i sz; i++) hash = (hash ^ str[i]) * 0x01000193; return hash;}/* * Add a new value to the configuration string. */static void add_to_hashtable(const char *name, int len, unsigned int hash, struct item *hashtab[]){ struct item *aux = malloc(sizeof(*aux) + len); if (!aux) { perror("fixdep:malloc"); exit(1); } memcpy(aux-name, name, len); aux-len = len; aux-hash = hash; aux-next = hashtab[hash % HASHSZ]; hashtab[hash % HASHSZ] = aux;}/* * Lookup a string in the hash table. If found, just return true. * If not, add it to the hashtable and return false. */static bool in_hashtable(const char *name, int len, struct item *hashtab[]){ struct item *aux; unsigned int hash = strhash(name, len); for (aux = hashtab[hash % HASHSZ]; aux; aux = aux-next) { if (aux-hash == hash aux-len == len memcmp(aux-name, name, len) == 0) return true; }
  • dismissl
Over 40 millioner storyboards skabt
Ingen Downloads, Intet Kreditkort og Intet Login Nødvendigt for at Prøve!
Storyboard That Familie