Index: trunk/include/samhain.h
===================================================================
--- trunk/include/samhain.h	(revision 68)
+++ trunk/include/samhain.h	(revision 76)
@@ -301,4 +301,21 @@
  **************************************************/
 
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#define SH_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define SH_GNUC_NULL_TERMINATED
+#endif
+
+/* The semantics of the built-in are that it is expected that expr == const
+ * for __builtin_expect ((expr), const)
+ */
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define SH_LIKELY(expr)   (__builtin_expect((expr), 1))
+#define SH_UNLIKELY(expr) (__builtin_expect((expr), 0))
+#else
+#define SH_LIKELY(expr) (expr)
+#define SH_UNLIKELY(expr) (expr)
+#endif
+
 /* signal-safe log function
  */
Index: trunk/include/sh_utils.h
===================================================================
--- trunk/include/sh_utils.h	(revision 68)
+++ trunk/include/sh_utils.h	(revision 76)
@@ -61,4 +61,5 @@
 
 char * sh_util_strdup (const char * str);
+char * sh_util_strdup_l (const char * str, size_t len);
 char * sh_util_strsep (char **str, const char *delim);
 
@@ -143,5 +144,5 @@
  * Arhument list must be NULL terminated.
  */
-char * sh_util_strconcat (const char * arg1, ...);
+char * sh_util_strconcat (const char * arg1, ...) SH_GNUC_NULL_TERMINATED;
 
 /* check if string is numeric only
Index: trunk/include/slib.h
===================================================================
--- trunk/include/slib.h	(revision 68)
+++ trunk/include/slib.h	(revision 76)
@@ -293,5 +293,5 @@
    * ---------------------------------------------------------------- */
 
-  SL_TICKET sl_make_ticket (int fd, char * path);
+  SL_TICKET sl_make_ticket (int fd, const char * path);
 
   /* Open for writing.
@@ -365,4 +365,8 @@
    */
   int sl_write_line (SL_TICKET ticket, void * msg, long nbytes);
+
+  /* As above, but only for non-constant strings.
+   */
+  int sl_write_line_fast (SL_TICKET ticket, void * msg, long nbytes);
 
   /* Drop all metadata for file descriptors >= fd.
@@ -414,5 +418,7 @@
 #define SL_NOPRIV  0x34
 
-#define MAXFILENAME	2048
+/* Suitable for Linux
+ */
+#define MAXFILENAME	4096
 
 
