7 * DIGITAL EQUIPMENT CORPORATION
8 * MAYNARD, MASSACHUSETTS
11 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
12 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
13 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
14 * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
17 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
18 * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
19 * ADDITION TO THAT SET FORTH ABOVE.
21 * Permission to use, copy, modify, and distribute this software and its
22 * documentation for any purpose and without fee is hereby granted, provided
23 * that the above copyright notice appear in all copies and that both that
24 * copyright notice and this permission notice appear in supporting
25 * documentation, and that the name of Digital Equipment Corporation not be
26 * used in advertising or publicity pertaining to distribution of the
27 * software without specific, written prior permission.
30 /***====================================================================***/
36 #include <X11/Xfuncproto.h>
39 recalloc(void *ptr, size_t old_size, size_t new_size);
42 * We sometimes malloc strings and then expose them as const char*'s. This
43 * macro is used when we free these strings in order to avoid -Wcast-qual
46 #define UNCONSTIFY(const_ptr) ((void *)(uintptr_t)(const_ptr))
48 #define uTypedAlloc(t) ((t*)malloc(sizeof(t)))
49 #define uTypedCalloc(n, t) ((t*)calloc((n), sizeof(t)))
50 #define uTypedRealloc(pO, n, t) ((t*)realloc((pO), (n) * sizeof(t)))
51 #define uTypedRecalloc(pO, o, n, t) ((t*)recalloc((pO), (o) * sizeof(t), (n) * sizeof(t)))
53 #define uDupString(s) ((s) ? strdup(s) : NULL)
54 #define uStringText(s) ((s) == NULL ? "<NullString>" : (s))
55 #define uStrCasePrefix(s1, s2) (strncasecmp((s1), (s2), strlen(s1)) == 0)
57 /***====================================================================***/
60 uSetErrorFile(char *name);
62 #define INFO uInformation
64 extern _X_ATTRIBUTE_PRINTF(1, 2) void
65 uInformation(const char *s, ...);
67 #define ACTION uAction
69 extern _X_ATTRIBUTE_PRINTF(1, 2) void
70 uAction(const char *s, ...);
74 extern _X_ATTRIBUTE_PRINTF(1, 2) void
75 uWarning(const char *s, ...);
79 extern _X_ATTRIBUTE_PRINTF(1, 2) void
80 uError(const char *s, ...);
82 #define FATAL uFatalError
84 extern _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN void
85 uFatalError(const char *s, ...);
87 /* WSGO stands for "Weird Stuff Going On" (wtf???) */
88 #define WSGO uInternalError
90 extern _X_ATTRIBUTE_PRINTF(1, 2) void
91 uInternalError(const char *s, ...);