1
--- mem.c 2011-03-29 20:36:18.000000000 +0800
2
+++ mem.c89.c 2011-03-29 20:36:24.000000000 +0800
7
+/* C++ warning completely irrelevant for C */
8
+#pragma warning( disable : 4996 )
9
if (!strcasecmp (string, "all"))
11
- for (unsigned i = 0; i < nkeys; i++)
14
+ for (i = 0; i < nkeys; i++)
15
result |= keys[i].value;
18
else if (!strcasecmp (string, "help"))
20
fprintf (stderr, "Supported debug values:");
21
- for (unsigned i = 0; i < nkeys; i++)
24
+ for (i = 0; i < nkeys; i++)
25
fprintf (stderr, " %s", keys[i].key);
27
fprintf (stderr, "\n");
31
const char* q = strpbrk (string, ":;, \t");
33
q = string + strlen (string);
34
- for (unsigned i = 0; i < nkeys; i++)
37
+ for (i = 0; i < nkeys; i++)
38
if (debug_key_matches (keys[i].key, string, (unsigned)(q - string)))
39
result |= keys[i].value;
46
+#pragma warning( default : 4996 )
51
if (pgm_atomic_exchange_and_add32 (&mem_ref_count, 1) > 0)
55
const errno_t err = pgm_dupenv_s (&env, &envlen, "PGM_DEBUG");
56
if (0 == err && envlen > 0) {
57
flags = pgm_parse_debug_string (env, keys, PGM_N_ELEMENTS (keys));
63
pgm_mem_gc_friendly = TRUE;
66
pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes",
67
__FILE__, __LINE__, __PRETTY_FUNCTION__,
69
+ (unsigned long)n_bytes);
71
pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes",
74
+ (unsigned long)n_bytes);
80
pgm_fatal ("file %s: line %d (%s): overflow allocating %" PRIzu "*%" PRIzu " bytes",
81
__FILE__, __LINE__, __PRETTY_FUNCTION__,
82
- n_blocks, block_bytes);
83
+ (unsigned long)n_blocks, (unsigned long)block_bytes);
85
pgm_fatal ("file %s: line %d: overflow allocating %" PRIzu "*%" PRIzu " bytes",
87
- n_blocks, block_bytes);
88
+ (unsigned long)n_blocks, (unsigned long)block_bytes);
91
return pgm_malloc (n_blocks * block_bytes);
94
pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu " bytes",
95
__FILE__, __LINE__, __PRETTY_FUNCTION__,
97
+ (unsigned long)n_bytes);
99
pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu " bytes",
102
+ (unsigned long)n_bytes);
106
@@ -232,11 +246,11 @@
108
pgm_fatal ("file %s: line %d (%s): failed to allocate %" PRIzu "*%" PRIzu " bytes",
109
__FILE__, __LINE__, __PRETTY_FUNCTION__,
110
- n_blocks, block_bytes);
111
+ (unsigned long)n_blocks, (unsigned long)block_bytes);
113
pgm_fatal ("file %s: line %d: failed to allocate %" PRIzu "*%" PRIzu " bytes",
115
- n_blocks, block_bytes);
116
+ (unsigned long)n_blocks, (unsigned long)block_bytes);