]> andersk Git - moira.git/blobdiff - server/cache.pc
second code style cleanup: void/void * usage, proper #includes. try to
[moira.git] / server / cache.pc
index eb49781f8b6e15534e81569112f4c750f2d86cca..352b1a697ab70131597910c2af648afc32523857 100644 (file)
@@ -1,21 +1,23 @@
-/*
- *     $Header$
+/* $Id$
  *
- *     Copyright (C) 1989, 1990 by the Massachusetts Institute of Technology
- *     For copying and distribution information, please see the file
- *     <mit-copyright.h>.
+ * Keep a cache of name/id mappings
+ *
+ * Copyright (C) 1989-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
  */
 
-#ifndef lint
-static char *rcsid_cache_dc = "$Header$";
-#endif lint
-
 #include <mit-copyright.h>
-#include <string.h>
 #include "mr_server.h"
 #include "query.h"
+
+#include <stdlib.h>
+#include <string.h>
+
 EXEC SQL INCLUDE sqlca;
 
+RCSID("$Header$");
+
 EXEC SQL WHENEVER SQLERROR DO dbmserr();
 
 extern char *whoami;
@@ -40,6 +42,7 @@ static int cachesize;
 /* statistics counters */
 int cachehits = 0, cachemisses = 0;
 
+int hashname(char *name, enum tables type);
 
 /* Name hash function. */
 
@@ -205,7 +208,7 @@ int id_to_name(int id, enum tables type, char **name)
       if (i->id != id || type != i->type)
        continue;
       free(*name);
-      *name = strsave(i->name);
+      *name = strdup(i->name);
       cachehits++;
       i->next->prev = i->prev;
       i->prev->next = i->next;
@@ -249,7 +252,7 @@ int id_to_name(int id, enum tables type, char **name)
     {
       free(*name);
       sprintf(iname, "#%d", j);
-      *name = strsave(iname);
+      *name = strdup(iname);
       return MR_NO_MATCH;
     }
   if (sqlca.sqlerrd[2] > 1)
@@ -257,7 +260,7 @@ int id_to_name(int id, enum tables type, char **name)
   if (sqlca.sqlcode)
     return MR_DBMS_ERR;
   free(*name);
-  *name = strsave(strtrim(iname));
+  *name = strdup(strtrim(iname));
   if (**name == '#' && type != USERS_TABLE)
     return MR_SUCCESS;
   if (cachesize < CACHESIZE)
This page took 0.038868 seconds and 4 git commands to generate.