summaryrefslogtreecommitdiffstats
path: root/src/utils.h
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-12-28 13:13:58 +0000
committerFrederic Culot <calcurse@culot.org>2008-12-28 13:13:58 +0000
commit5352496984d550bd441b12a082d5a382c168cbe2 (patch)
tree8a61b0785ba0d2f9edde566bef372360244949e3 /src/utils.h
parenta63c74892085e6bd5ea8b88712f44d1567ce7ed3 (diff)
downloadcalcurse-5352496984d550bd441b12a082d5a382c168cbe2.tar.gz
calcurse-5352496984d550bd441b12a082d5a382c168cbe2.zip
Added wrappers around libc's memory management functions, to easily debug memory usage
Diffstat (limited to 'src/utils.h')
-rwxr-xr-xsrc/utils.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/utils.h b/src/utils.h
index d076c06..0be7d85 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.40 2008/12/12 20:44:50 culot Exp $ */
+/* $calcurse: utils.h,v 1.41 2008/12/28 13:13:59 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -42,11 +42,11 @@
int len; \
\
len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
- snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
+ (void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
if (ui_mode == UI_CURSES) \
fatalbox (msg); \
else \
- fprintf (stderr, "%s\n", msg); \
+ (void)fprintf (stderr, "%s\n", msg); \
} while (0)
#define EXIT(...) do { \
@@ -78,9 +78,13 @@
} \
} while (0)
-#define GETSTRING_VALID 0 /* value returned by getstring() if text is valid */
-#define GETSTRING_ESC 1 /* user pressed escape to cancel editing */
-#define GETSTRING_RET 2 /* return was pressed without entering any text */
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define __FILE_POS__ __FILE__ ":" TOSTRING(__LINE__)
+
+#define GETSTRING_VALID 0 /* value returned by getstring() if text is valid */
+#define GETSTRING_ESC 1 /* user pressed escape to cancel editing */
+#define GETSTRING_RET 2 /* return was pressed without entering any text */
typedef struct {
const char *str;
@@ -128,6 +132,6 @@ char *new_tempfile (const char *, int);
void erase_note (char **, erase_flag_e);
int parse_date (char *, int, int *, int *, int *);
char *str_toupper (char *);
-void mem_free (void *ptr);
+void file_close (FILE *, const char *);
#endif /* CALCURSE_UTILS_H */