]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/bsys.c
Fix problem of accents with new Win32 code.
[bacula/bacula] / bacula / src / lib / bsys.c
index 3f6afaa3caf67c14a43d4c1b642da7be5469c67e..548ab97b2a6fbdb4ba562230f641f709ada893cd 100644 (file)
@@ -8,7 +8,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -113,6 +113,16 @@ char *bstrncat(char *dest, POOL_MEM &src, int maxlen)
    return dest;
 }
 
+/*
+ * Allows one or both pointers to be NULL
+ */
+bool bstrcmp(const char *s1, const char *s2)
+{
+   if (s1 == s2) return true;
+   if (s1 == NULL || s2 == NULL) return false;
+   return strcmp(s1, s2) == 0;
+}
+
 /*
  * Get character length of UTF-8 string
  *
@@ -173,7 +183,8 @@ void *bmalloc(size_t size)
 
   buf = malloc(size);
   if (buf == NULL) {
-     Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), strerror(errno));
+     berrno be;
+     Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror());
   }
   return buf;
 }
@@ -189,7 +200,8 @@ void *b_malloc(const char *file, int line, size_t size)
   buf = malloc(size);
 #endif
   if (buf == NULL) {
-     e_msg(file, line, M_ABORT, 0, _("Out of memory: ERR=%s\n"), strerror(errno));
+     berrno be;
+     e_msg(file, line, M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror());
   }
   return buf;
 }
@@ -199,7 +211,8 @@ void *brealloc (void *buf, size_t size)
 {
    buf = realloc(buf, size);
    if (buf == NULL) {
-      Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), strerror(errno));
+      berrno be;
+      Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror());
    }
    return buf;
 }
@@ -211,7 +224,8 @@ void *bcalloc (size_t size1, size_t size2)
 
    buf = calloc(size1, size2);
    if (buf == NULL) {
-      Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), strerror(errno));
+      berrno be;
+      Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror());
    }
    return buf;
 }