]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - compat/xalloc.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / compat / xalloc.cc
index bfde416116360841a680ca3efc99b97d2e3e69d0..0fa94f9f79915bdd6a92cf08ef82e492ad6dd488 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #include "squid.h"
 #include "compat/xalloc.h"
 #include "profiler/Profiler.h"
@@ -78,7 +86,7 @@ xcalloc(size_t n, size_t sz)
     if (p == NULL) {
         if (failure_notify) {
             static char msg[128];
-            snprintf(msg, 128, "xcalloc: Unable to allocate %lu blocks of %lu bytes!\n", (unsigned long)n, (unsigned long)sz);
+            snprintf(msg, 128, "xcalloc: Unable to allocate %" PRIuSIZE " blocks of %" PRIuSIZE " bytes!\n", n, sz);
             failure_notify(msg);
         } else {
             perror("xcalloc");
@@ -109,7 +117,7 @@ xmalloc(size_t sz)
     if (p == NULL) {
         if (failure_notify) {
             static char msg[128];
-            snprintf(msg, 128, "xmalloc: Unable to allocate %lu bytes!\n", (unsigned long)sz);
+            snprintf(msg, 128, "xmalloc: Unable to allocate %" PRIuSIZE " bytes!\n", sz);
             failure_notify(msg);
         } else {
             perror("malloc");
@@ -140,7 +148,7 @@ xrealloc(void *s, size_t sz)
     if (p == NULL) {
         if (failure_notify) {
             static char msg[128];
-            snprintf(msg, 128, "xrealloc: Unable to reallocate %lu bytes!\n", (unsigned long)sz);
+            snprintf(msg, 128, "xrealloc: Unable to reallocate %" PRIuSIZE " bytes!\n", sz);
             failure_notify(msg);
         } else {
             perror("realloc");
@@ -168,3 +176,4 @@ free_const(const void *s_const)
     PROF_stop(free);
     PROF_stop(free_const);
 }
+