/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/cdt/dtstrhash.c

Go to the documentation of this file.
00001 /* $Id: dtstrhash.c,v 1.1.1.1 2004/12/23 04:04:01 ellson Exp $ $Revision: 1.1.1.1 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #include        "dthdr.h"
00018 
00019 #ifdef DMALLOC
00020 #include "dmalloc.h"
00021 #endif
00022 
00023 /*      Hashing a string
00024 **
00025 **      Written by Kiem-Phong Vo (05/22/96)
00026 */
00027 #if __STD_C
00028 uint dtstrhash(reg uint h, Void_t * args, reg int n)
00029 #else
00030 uint dtstrhash(h, args, n)
00031 reg uint h;
00032 Void_t *args;
00033 reg int n;
00034 #endif
00035 {
00036     reg unsigned char *s = (unsigned char *) args;
00037 
00038     if (n <= 0) {
00039         for (; (n = *s) != 0; ++s)
00040             h = dtcharhash(h, n);
00041     } else {
00042         reg unsigned char *ends;
00043         for (ends = s + n; s < ends; ++s) {
00044             n = *s;
00045             h = dtcharhash(h, n);
00046         }
00047     }
00048 
00049     return h;
00050 }

Generated on Mon Mar 31 19:03:23 2008 for Graphviz by  doxygen 1.5.1