~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to cdt/dtstrhash.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This software may only be used by you under license from AT&T Corp.
 
3
    ("AT&T").  A copy of AT&T's Source Code Agreement is available at
 
4
    AT&T's Internet website having the URL:
 
5
    <http://www.research.att.com/sw/tools/graphviz/license/source.html>
 
6
    If you received this software without first entering into a license
 
7
    with AT&T, you have an infringing copy of this software and cannot use
 
8
    it without violating AT&T's intellectual property rights.
 
9
*/
 
10
#include        "dthdr.h"
 
11
 
 
12
#ifdef DMALLOC
 
13
#include "dmalloc.h"
 
14
#endif
 
15
 
 
16
/*      Hashing a string
 
17
**
 
18
**      Written by Kiem-Phong Vo (05/22/96)
 
19
*/
 
20
#if __STD_C
 
21
uint dtstrhash(reg uint h, Void_t* args, reg int n)
 
22
#else
 
23
uint dtstrhash(h,args,n)
 
24
reg uint        h;
 
25
Void_t*         args;
 
26
reg int         n;
 
27
#endif
 
28
{
 
29
        reg unsigned char*      s = (unsigned char*)args;
 
30
 
 
31
        if(n <= 0)
 
32
        {       for(; (n = *s) != 0; ++s)
 
33
                        h = dtcharhash(h,n);
 
34
        }
 
35
        else
 
36
        {       reg unsigned char*      ends;
 
37
                for(ends = s+n; s < ends; ++s)
 
38
                {       n = *s;
 
39
                        h = dtcharhash(h,n);
 
40
                }
 
41
        }
 
42
 
 
43
        return h;
 
44
}