]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
made a function getKeyCounter() to automatically increment a counter
authorwessels <>
Sat, 13 Apr 1996 03:22:16 +0000 (03:22 +0000)
committerwessels <>
Sat, 13 Apr 1996 03:22:16 +0000 (03:22 +0000)
and make sure it never equals zero.  For use with private keys
and ICP query headers.

src/store.cc

index f5f0a45a4c74f6df87cb12df914a518e6a9d1fa6..b3a7d4ca7133541dce85bbe5c0123150ac3bc3eb 100644 (file)
@@ -1,6 +1,6 @@
 
-/* $Id: store.cc,v 1.46 1996/04/12 05:15:30 wessels Exp $ */
-#ident "$Id: store.cc,v 1.46 1996/04/12 05:15:30 wessels Exp $"
+/* $Id: store.cc,v 1.47 1996/04/12 21:22:16 wessels Exp $ */
+#ident "$Id: store.cc,v 1.47 1996/04/12 21:22:16 wessels Exp $"
 
 /*
  * DEBUG: Section 20          store
@@ -94,9 +94,6 @@ static int swaplog_lock = 0;
 FILE *swaplog_stream = NULL;
 static int storelog_fd = -1;
 
-/* counter for uncachable objects */
-static int key_counter = 0;
-
 /* key temp buffer */
 static char key_temp_buffer[MAX_URL];
 static char swaplog_file[MAX_FILE_NAME_LEN];
@@ -491,15 +488,21 @@ StoreEntry *storeGet(url)
     return NULL;
 }
 
+unsigned int getKeyCounter()
+{
+       static unsigned int key_counter = 0;
+       if (++key_counter == 0)
+          ++key_counter;
+       return key_counter;
+}
+
 char *storeGeneratePrivateKey(url, method, num)
      char *url;
      int method;
      int num;
 {
-    if (key_counter == 0)
-       key_counter++;
     if (num == 0)
-       num = key_counter++;
+       num = getKeyCounter();
     debug(20, 3, "storeGeneratePrivateKey: '%s'\n", url);
     key_temp_buffer[0] = '\0';
     sprintf(key_temp_buffer, "%d/%s/%s",
@@ -2631,20 +2634,6 @@ int swapInError(fd_unused, entry)
     return 0;
 }
 
-int storePendingFirstFD(e)
-    StoreEntry *e;
-{
-        int s;
-        int i;
-       if (!e->mem_obj)
-               return -1;
-       s = (int) e->mem_obj->pending_list_size;
-       for (i=0; i<s; i++)
-               if (e->mem_obj->pending[i])
-                       return e->mem_obj->pending[i]->fd;
-       return -1;
-}
-
 int storePendingNClients(e)
      StoreEntry *e;
 {