chiark / gitweb /
changelog: start 0.6.8
[secnet.git] / util.c
diff --git a/util.c b/util.c
index 977e131fbeda106fcaa8fe7964af878ccbe2ebe9..3e8d56eaebbc50855ed2cde7026b5bf5be7c0767 100644 (file)
--- a/util.c
+++ b/util.c
@@ -183,15 +183,6 @@ char *write_mpstring(MP_INT *a)
     return buff;
 }
 
-int32_t write_mpbin(MP_INT *a, uint8_t *buffer, int32_t buflen)
-{
-    char *hb = write_mpstring(a);
-    int32_t len;
-    hex_decode(buffer, buflen, &len, hb, True);
-    free(hb);
-    return len;
-}
-
 #define DEFINE_SETFDFLAG(fn,FL,FLAG)                                   \
 void fn(int fd) {                                                      \
     int r=fcntl(fd, F_GET##FL);                                                \
@@ -723,6 +714,15 @@ const char *pollbadbit(int revents)
     return 0;
 }
 
+void pathprefix_template_init(struct pathprefix_template *out,
+                             const char *prefix, int maxsuffix)
+{
+    size_t l=strlen(prefix);
+    NEW_ARY(out->buffer,l+maxsuffix+1);
+    strcpy(out->buffer,prefix);
+    out->write_here=out->buffer+l;
+}
+
 enum async_linebuf_result
 async_linebuf_read(struct pollfd *pfd, struct buffer_if *buf,
                   const char **emsg_out)