register removal from /usr/src/sbin/rcorder/hash.c

Liam J. Foy liamfoy at sepulcrum.org
Wed Dec 1 11:02:02 PST 2004


On Wed, 2004-12-01 at 18:48 +0000, Steve Mynott wrote:
> Simple register removal from /usr/src/sbin/rcorder/hash.c below as diff
> 
> The NetBSD rcsid[] and __RCSID  could be removed too (not present in this diff)
> 
> This file is virtually the same as /usr/src/usr.bin/make/hash.c which
> had some recent similar cleanups.
> 
> Cheers Steve
> 
> --- hash.c      2004-12-01 18:32:30.000000000 +0000
> +++ hash.c.20041130     2003-11-01 17:16:01.000000000 +0000
> @@ -103,7 +103,7 @@
>   */
> 
>  /*
> - * Hash_Table *t;      Structure to use to hold table.
> + * register Hash_Table *t;     Structure to use to hold table.
>   * int numBuckets;                     How many buckets to create for starters.
>   *                                                             This number is $
>   *                                                             two.   If <= 0,$
> @@ -111,10 +111,10 @@
>   *                                                             as needed.
>   */
>  void
> -Hash_InitTable(Hash_Table *t, int numBuckets)
> +Hash_InitTable(register Hash_Table *t, int numBuckets)
>  {
> -       int i;
> -       struct Hash_Entry **hp;
> +       register int i;
> +       register struct Hash_Entry **hp;
> 
>         /*
>          * Round up the size to a power of two.
> @@ -154,8 +154,8 @@
>  void
>  Hash_DeleteTable(Hash_Table *t)
>  {
> -       struct Hash_Entry **hp, *h, *nexth = NULL;
> -       int i;
> +       register struct Hash_Entry **hp, *h, *nexth = NULL;
> +       register int i;
> 
>         for (hp = t->bucketPtr, i = t->size; --i >= 0;) {
>                 for (h = *hp++; h != NULL; h = nexth) {
> @@ -193,9 +193,9 @@
>  Hash_Entry *
>  Hash_FindEntry(Hash_Table *t, char *key)
>  {
> -       Hash_Entry *e;
> -       unsigned h;
> -       char *p;
> +       register Hash_Entry *e;
> +       register unsigned h;
> +       register char *p;
> 
>         for (h = 0, p = key; *p;)
>                 h = (h << 5) - h + *p++;
> @@ -226,11 +226,11 @@
>   */
> 
>  Hash_Entry *
> -Hash_CreateEntry(Hash_Table *t, char *key, Boolean *newPtr)
> +Hash_CreateEntry(register Hash_Table *t, char *key, Boolean *newPtr)
>  {
> -       Hash_Entry *e;
> -       unsigned h;
> -       char *p;
> +       register Hash_Entry *e;
> +       register unsigned h;
> +       register char *p;
>         int keylen;
>         struct Hash_Entry **hp;
> 
> @@ -291,7 +291,7 @@
>  void
>  Hash_DeleteEntry(Hash_Table *t, Hash_Entry *e)
>  {
> -       Hash_Entry **hp, *p;
> +       register Hash_Entry **hp, *p;
>         if (e == NULL)
>                 return;
> @@ -328,7 +328,7 @@
>   */
> 
>  Hash_Entry *
> -Hash_EnumFirst(Hash_Table *t, Hash_Search *searchPtr)
> +Hash_EnumFirst(Hash_Table *t, register Hash_Search *searchPtr)
>  {
>         searchPtr->tablePtr = t;
>         searchPtr->nextIndex = 0;
> @@ -355,9 +355,9 @@
>   */
> 
>  Hash_Entry *
> -Hash_EnumNext(Hash_Search *searchPtr)
> +Hash_EnumNext(register Hash_Search *searchPtr)
>  {
> -       Hash_Entry *e;
> +       register Hash_Entry *e;
>         Hash_Table *t = searchPtr->tablePtr;
> 
>         /*
> @@ -399,11 +399,11 @@
>   */
> 
>  static void
> -RebuildTable(Hash_Table *t)
> +RebuildTable(register Hash_Table *t)
>  {
> -       Hash_Entry *e, *next = NULL, **hp, **xp;
> -       int i, mask;
> -        Hash_Entry **oldhp;
> +       register Hash_Entry *e, *next = NULL, **hp, **xp;
> +       register int i, mask;
> +        register Hash_Entry **oldhp;
>         int oldsize;
> 
>         oldhp = t->bucketPtr;

Maybe I am confused about what you are trying to do, but this patch
adds registers and doesnt remove them. Have you diff'ed correctly?

-- 
Liam J. Foy
<liamfoy at xxxxxxxxxxxxx>







More information about the Submit mailing list