From: wessels <> Date: Sat, 13 Apr 1996 03:22:16 +0000 (+0000) Subject: made a function getKeyCounter() to automatically increment a counter X-Git-Tag: SQUID_3_0_PRE1~6196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04e8dbaa02efd49485d8d0927bc147c2ea62acb7;p=thirdparty%2Fsquid.git made a function getKeyCounter() to automatically increment a counter and make sure it never equals zero. For use with private keys and ICP query headers. --- diff --git a/src/store.cc b/src/store.cc index f5f0a45a4c..b3a7d4ca71 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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; imem_obj->pending[i]) - return e->mem_obj->pending[i]->fd; - return -1; -} - int storePendingNClients(e) StoreEntry *e; {