Lines Matching defs:hash

74  * History lines are recorded in a hash table, such that repeated
77 * Start by defining the size of the hash table. This should be a
85 * Each history line will be represented in the hash table by a
90 GlhHashBucket *bucket; /* The parent hash-table bucket of this node */
92 /* parent hash-table bucket. */
106 static int _glh_is_line(GlhHashNode *hash, const char *line, size_t n);
108 static void _glh_return_line(GlhHashNode *hash, char *line, size_t dim);
111 * All history lines which hash to a given bucket in the hash table, are
125 GlhHashBucket bucket[GLH_HASH_SIZE]; /* The buckets of the hash table */
139 GlhHashNode *line; /* The hash-table entry of the history line */
180 GlhLineHash hash; /* A hash-table of reference-counted history lines */
275 glh->hash.node_mem = NULL;
277 glh->hash.bucket[i].lines = NULL;
324 glh->hash.node_mem = _new_FreeList(sizeof(GlhLineNode), GLH_HASH_INCR);
325 if(!glh->hash.node_mem)
375 glh->hash.node_mem = _del_FreeList(glh->hash.node_mem, 1);
408 GlhHashNode *hnode; /* The hash-table node of the line */
469 * then return a reference-counted hash-node pointer to this copy.
492 * Record a pointer to the hash-table record of the line in the new
1710 GlhHashBucket *b = glh->hash.bucket + i;
1827 * Clear the hash table.
1830 glh->hash.bucket[i].lines = NULL;
1831 _rst_FreeList(glh->hash.node_mem);
2158 * then return a reference-counted hash-node pointer to this copy.
2166 * return GlhHashNode * The hash-node containing the stored line, or
2172 GlhHashBucket *bucket; /* The hash-table bucket of the line */
2173 GlhHashNode *hnode; /* The hash-table node of the line */
2216 * Create a new hash-node for the line.
2218 hnode = (GlhHashNode *) _new_FreeListNode(glh->hash.node_mem);
2223 * the hash node.
2231 * Prepend the new hash node to the list within the associated bucket.
2236 * Initialize the rest of the members of the hash node.
2251 * Decrement the reference count of the history line of a given hash-node,
2252 * and if the count reaches zero, delete both the hash-node and the
2259 * return GlhHashNode * The deleted hash-node (ie. NULL).
2266 * If decrementing the reference count of the hash-node doesn't reduce
2269 * access to the hash-node copy has been deleted.
2274 * Remove the hash-node from the list in its parent bucket.
2287 * Return the line segments of the hash-node to the list of unused segments.
2293 * Get the last node of the list of line segments referenced in the hash-node,
2299 * Prepend the list of line segments used by the hash node to the
2308 * Return the container of the hash-node to the freelist.
2310 hnode = (GlhHashNode *) _del_FreeListNode(glh->hash.node_mem, hnode);
2316 * Private function to locate the hash bucket associated with a given
2319 * This uses a hash-function described in the dragon-book
2329 * return GlhHashBucket * The located hash-bucket.
2340 return glh->hash.bucket + (h % GLH_HASH_SIZE);
2344 * Find a given history line within a given hash-table bucket.
2347 * bucket GlhHashBucket * The hash-table bucket in which to search.
2352 * return GlhHashNode * The hash-table entry of the line, or NULL
2374 * hash GlhHashNode * The hash-table entry of the line.
2383 static int _glh_is_line(GlhHashNode *hash, const char *line, size_t n)
2390 if(n != hash->len)
2396 for(seg=hash->head; n>0 && seg; seg=seg->next) {
2462 * hash GlhHashNode The hash-table entry of the history line to
2467 static void _glh_return_line(GlhHashNode *hash, char *line, size_t dim)
2471 for(seg=hash->head; dim>0 && seg; seg=seg->next) {