]> mj.ucw.cz Git - libucw.git/commitdiff
Removed tempfile functions (nobody uses them and they probably belong
authorMartin Mares <mj@ucw.cz>
Tue, 27 Mar 2001 10:57:33 +0000 (10:57 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 27 Mar 2001 10:57:33 +0000 (10:57 +0000)
to fastbuf.c anyway).

lib/Makefile
lib/lib.h
lib/temp.c [deleted file]

index 2a2ec59d2f17fc14449986f99cdd1e1c76e543b1..d80125761160faea6374347be2d56161439d59d8 100644 (file)
@@ -5,7 +5,7 @@ PROGS+=obj/lib/db-rebuild obj/lib/buckettool
 
 SHLIB_OBJS=alloc.o alloc_str.o ctmatch.o db.o fastbuf.o fb-file.o fb-mem.o lists.o \
        log.o log2.o md5.o md5hex.o mmap.o pagecache.o patimatch.o patmatch.o pool.o \
-       prime.o random.o realloc.o regex.o temp.o timer.o url.o wildmatch.o \
+       prime.o random.o realloc.o regex.o timer.o url.o wildmatch.o \
        wordsplit.o str_ctype.o str_upper.o bucket.o conf.o object.o sorter.o \
        finger.o proctitle.o
 
index 0fe45010f2419ad4ba3b03ae74ac030444d2845d..dcf97932d3d1bebd9d3bce1e43be872fbee74098 100644 (file)
--- a/lib/lib.h
+++ b/lib/lib.h
 #define ABS(x) ((x) < 0 ? -(x) : (x))
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
 
-/* Temporary Files */
-
-#define TMP_DIR "tmp"
-#define TMP_DIR_LEN 3
-
-struct tempfile {
-  int fh;
-  byte name[32];
-};
-
-void open_temp(struct tempfile *, byte *);
-void delete_temp(struct tempfile *);
-u32 temprand(uns);
-
 /* Logging */
 
 #define L_DEBUG                'D'             /* Debugging messages */
diff --git a/lib/temp.c b/lib/temp.c
deleted file mode 100644 (file)
index 600f317..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *     Sherlock Library -- Temporary Files
- *
- *     (c) 1997 Martin Mares <mj@ucw.cz>
- */
-
-#include "lib/lib.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-u32
-temprand(uns key)
-{
-  static int seeded = 0;
-  u32 rand;
-
-  if (!seeded)
-    {
-      seeded = 1;
-      srand(getpid());
-    }
-  rand = random() << 1;
-  rand += key * 0xdeadbeef;
-  return rand;
-}
-
-void
-open_temp(struct tempfile *tf, byte *tftype)
-{
-  int retry = 50;
-  while (retry--)
-    {
-      sprintf(tf->name, TMP_DIR "/%s%08x", tftype, temprand(retry));
-      tf->fh = open(tf->name, O_RDWR | O_CREAT | O_EXCL, 0666);
-      if (tf->fh >= 0)
-       return;
-    }
-  die("Unable to create temporary file");
-}
-
-void
-delete_temp(struct tempfile *tf)
-{
-  close(tf->fh);
-  unlink(tf->name);
-}