]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fb-temp.c
conf2: insert a node into a list as soon as possible instead of at the end
[libucw.git] / lib / fb-temp.c
index a537dd934f7b7541068b006014f0c559bedf6f79..62c6e3820f963a9434365e18ee87508707207e65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     Sherlock Library -- Temporary Fastbufs
+ *     UCW Library -- Temporary Fastbufs
  *
  *     (c) 2002--2004 Martin Mares <mj@ucw.cz>
  *
@@ -8,7 +8,7 @@
  */
 
 #include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
 #include "lib/fastbuf.h"
 
 #include <unistd.h>
 
 static byte *temp_template = "/tmp/temp%d.%d";
 
-static struct cfitem temp_config[] = {
-  { "Tempfiles",       CT_SECTION,     NULL },
-  { "Template",                CT_STRING,      &temp_template },
-  { NULL,              CT_STOP,        NULL }
+static struct cf_section temp_config = {
+  CF_ITEMS {
+    CF_STRING("Template", &temp_template),
+    CF_END
+  }
 };
 
 static void CONSTRUCTOR temp_init_config(void)
 {
-  cf_register(temp_config);
+  cf_declare_section("Tempfiles", &temp_config, 0);
 }
 
 struct fastbuf *
-bopen_tmp(uns bufsize)
+bopen_tmp(uns buflen)
 {
   byte buf[256];
   struct fastbuf *f;
   static uns temp_counter;
 
   sprintf(buf, temp_template, (int) getpid(), temp_counter++);
-  f = bopen(buf, O_RDWR | O_CREAT | O_TRUNC, bufsize);
+  f = bopen(buf, O_RDWR | O_CREAT | O_TRUNC, buflen);
   bconfig(f, BCONFIG_IS_TEMP_FILE, 1);
   return f;
 }