]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - lib/string.h
Filter test: typo fix
[thirdparty/bird.git] / lib / string.h
index 2c47729427455f83e9e6f74bf4a8a23991b70d39..75cb88ddc82e0c1dddbc579c8adc06dc2b25bf37 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <stdarg.h>
 #include <string.h>
+#include <strings.h>
 
 int bsprintf(char *str, const char *fmt, ...);
 int bvsprintf(char *str, const char *fmt, va_list args);
@@ -21,6 +22,33 @@ int buffer_vprint(buffer *buf, const char *fmt, va_list args);
 int buffer_print(buffer *buf, const char *fmt, ...);
 void buffer_puts(buffer *buf, const char *str);
 
-int patmatch(byte *pat, byte *str);
+int patmatch(const byte *pat, const byte *str);
+
+static inline char *xbasename(const char *str)
+{
+  char *s = strrchr(str, '/');
+  return s ? s+1 : (char *) str;
+}
+
+static inline char *
+xstrdup(const char *c)
+{
+  size_t l = strlen(c) + 1;
+  char *z = xmalloc(l);
+  memcpy(z, c, l);
+  return z;
+}
+
+static inline void
+memset32(void *D, u32 val, uint n)
+{
+  u32 *dst = D;
+  uint i;
+
+  for (i = 0; i < n; i++)
+    dst[i] = val;
+}
+
+#define ROUTER_ID_64_LENGTH 23
 
 #endif