mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
Add an upstream patch to fix implicit declaration of functions and other issues. Indicate BSD license. Project has moved to GitHub. Closes: https://trac.macports.org/ticket/63244 See: https://trac.macports.org/ticket/53467
148 lines
6.2 KiB
Diff
148 lines
6.2 KiB
Diff
Fix some warnings on 64-bit compiler
|
|
https://github.com/stvchu/memcachedb/commit/9f601db6d4965bf9c254cb2bfaa1639ce6375ec9
|
|
--- item.c.orig 2008-10-14 00:40:58.000000000 -0500
|
|
+++ item.c 2021-07-16 02:57:13.000000000 -0500
|
|
@@ -188,18 +188,18 @@
|
|
ntotal = ITEM_ntotal(it);
|
|
if (ntotal > settings.item_buf_size){
|
|
if (settings.verbose > 1) {
|
|
- fprintf(stderr, "ntotal: %d, use free() directly.\n", ntotal);
|
|
+ fprintf(stderr, "ntotal: %"PRIuS", use free() directly.\n", ntotal);
|
|
}
|
|
free(it);
|
|
}else{
|
|
if (0 != item_add_to_freelist(it)) {
|
|
if (settings.verbose > 1) {
|
|
- fprintf(stderr, "ntotal: %d, add a item buffer to freelist fail, use free() directly.\n", ntotal);
|
|
+ fprintf(stderr, "ntotal: %"PRIuS", add a item buffer to freelist fail, use free() directly.\n", ntotal);
|
|
}
|
|
free(it);
|
|
}else{
|
|
if (settings.verbose > 1) {
|
|
- fprintf(stderr, "ntotal: %d, add a item buffer to freelist.\n", ntotal);
|
|
+ fprintf(stderr, "ntotal: %"PRIuS", add a item buffer to freelist.\n", ntotal);
|
|
}
|
|
}
|
|
}
|
|
--- memcachedb.c.orig 2008-10-14 00:40:58.000000000 -0500
|
|
+++ memcachedb.c 2021-07-16 02:57:13.000000000 -0500
|
|
@@ -837,26 +837,26 @@
|
|
#endif /* !WIN32 */
|
|
|
|
STATS_LOCK();
|
|
- pos += sprintf(pos, "STAT pid %u\r\n", pid);
|
|
- pos += sprintf(pos, "STAT uptime %ld\r\n", now - stats.started);
|
|
- pos += sprintf(pos, "STAT time %ld\r\n", now);
|
|
+ pos += sprintf(pos, "STAT pid %ld\r\n", (long)pid);
|
|
+ pos += sprintf(pos, "STAT uptime %"PRIuS"\r\n", now - stats.started);
|
|
+ pos += sprintf(pos, "STAT time %"PRIuS"\r\n", now);
|
|
pos += sprintf(pos, "STAT version " VERSION "\r\n");
|
|
- pos += sprintf(pos, "STAT pointer_size %d\r\n", 8 * sizeof(void *));
|
|
+ pos += sprintf(pos, "STAT pointer_size %"PRIuS"\r\n", 8 * sizeof(void *));
|
|
#ifndef WIN32
|
|
pos += sprintf(pos, "STAT rusage_user %ld.%06ld\r\n", usage.ru_utime.tv_sec, usage.ru_utime.tv_usec);
|
|
pos += sprintf(pos, "STAT rusage_system %ld.%06ld\r\n", usage.ru_stime.tv_sec, usage.ru_stime.tv_usec);
|
|
#endif /* !WIN32 */
|
|
- pos += sprintf(pos, "STAT ibuffer_size %u\r\n", settings.item_buf_size);
|
|
- pos += sprintf(pos, "STAT curr_connections %u\r\n", stats.curr_conns - 1); /* ignore listening conn */
|
|
- pos += sprintf(pos, "STAT total_connections %u\r\n", stats.total_conns);
|
|
- pos += sprintf(pos, "STAT connection_structures %u\r\n", stats.conn_structs);
|
|
- pos += sprintf(pos, "STAT cmd_get %llu\r\n", stats.get_cmds);
|
|
- pos += sprintf(pos, "STAT cmd_set %llu\r\n", stats.set_cmds);
|
|
- pos += sprintf(pos, "STAT get_hits %llu\r\n", stats.get_hits);
|
|
- pos += sprintf(pos, "STAT get_misses %llu\r\n", stats.get_misses);
|
|
- pos += sprintf(pos, "STAT bytes_read %llu\r\n", stats.bytes_read);
|
|
- pos += sprintf(pos, "STAT bytes_written %llu\r\n", stats.bytes_written);
|
|
- pos += sprintf(pos, "STAT threads %u\r\n", settings.num_threads);
|
|
+ pos += sprintf(pos, "STAT item_buf_size %"PRIuS"\r\n", settings.item_buf_size);
|
|
+ pos += sprintf(pos, "STAT curr_connections %"PRIu32"\r\n", stats.curr_conns - 1); /* ignore listening conn */
|
|
+ pos += sprintf(pos, "STAT total_connections %"PRIu32"\r\n", stats.total_conns);
|
|
+ pos += sprintf(pos, "STAT connection_structures %"PRIu32"\r\n", stats.conn_structs);
|
|
+ pos += sprintf(pos, "STAT cmd_get %"PRIu64"\r\n", stats.get_cmds);
|
|
+ pos += sprintf(pos, "STAT cmd_set %"PRIu64"\r\n", stats.set_cmds);
|
|
+ pos += sprintf(pos, "STAT get_hits %"PRIu64"\r\n", stats.get_hits);
|
|
+ pos += sprintf(pos, "STAT get_misses %"PRIu64"\r\n", stats.get_misses);
|
|
+ pos += sprintf(pos, "STAT bytes_read %"PRIu64"\r\n", stats.bytes_read);
|
|
+ pos += sprintf(pos, "STAT bytes_written %"PRIu64"\r\n", stats.bytes_written);
|
|
+ pos += sprintf(pos, "STAT threads %d\r\n", settings.num_threads);
|
|
pos += sprintf(pos, "END");
|
|
STATS_UNLOCK();
|
|
out_string(c, temp);
|
|
@@ -1196,7 +1196,7 @@
|
|
if (delta >= value) value = 0;
|
|
else value -= delta;
|
|
}
|
|
- vlen = sprintf(buf, "%llu", value);
|
|
+ vlen = sprintf(buf, "%"PRId64, value);
|
|
|
|
/* flags was already lost - so recover them from ITEM_suffix(it) */
|
|
flags = (int) strtol(ITEM_suffix(old_it), (char **) NULL, 10);
|
|
@@ -1412,8 +1412,8 @@
|
|
process_stat(c, tokens, ntokens);
|
|
|
|
} else if (ntokens >= 2 && ntokens <= 3 && (strcmp(tokens[COMMAND_TOKEN].value, "flush_all") == 0)) {
|
|
- out_string(c, "OK");
|
|
- return;
|
|
+
|
|
+ out_string(c, "ERROR");
|
|
|
|
} else if (ntokens == 2 && (strcmp(tokens[COMMAND_TOKEN].value, "version") == 0)) {
|
|
|
|
--- memcachedb.h.orig 2008-10-14 00:40:58.000000000 -0500
|
|
+++ memcachedb.h 2021-07-16 02:57:13.000000000 -0500
|
|
@@ -81,10 +81,29 @@
|
|
# include <unistd.h>
|
|
#endif
|
|
|
|
+/* 64-bit Portable printf */
|
|
+/* printf macros for size_t, in the style of inttypes.h */
|
|
+#ifdef _LP64
|
|
+#define __PRIS_PREFIX "z"
|
|
+#else
|
|
+#define __PRIS_PREFIX
|
|
+#endif
|
|
+
|
|
+/* Use these macros after a % in a printf format string
|
|
+ to get correct 32/64 bit behavior, like this:
|
|
+ size_t size = records.size();
|
|
+ printf("%"PRIuS"\n", size); */
|
|
+
|
|
+#define PRIdS __PRIS_PREFIX "d"
|
|
+#define PRIxS __PRIS_PREFIX "x"
|
|
+#define PRIuS __PRIS_PREFIX "u"
|
|
+#define PRIXS __PRIS_PREFIX "X"
|
|
+#define PRIoS __PRIS_PREFIX "o"
|
|
+
|
|
struct stats {
|
|
- unsigned int curr_conns;
|
|
- unsigned int total_conns;
|
|
- unsigned int conn_structs;
|
|
+ uint32_t curr_conns;
|
|
+ uint32_t total_conns;
|
|
+ uint32_t conn_structs;
|
|
uint64_t get_cmds;
|
|
uint64_t set_cmds;
|
|
uint64_t get_hits;
|
|
--- stats.c.orig 2008-10-14 00:40:58.000000000 -0500
|
|
+++ stats.c 2021-07-16 02:57:13.000000000 -0500
|
|
@@ -18,6 +18,7 @@
|
|
*/
|
|
|
|
#include "memcachedb.h"
|
|
+#include <stdlib.h>
|
|
#include <db.h>
|
|
|
|
void stats_bdb(char *temp){
|
|
--- thread.c.orig 2008-10-14 00:40:58.000000000 -0500
|
|
+++ thread.c 2021-07-16 02:57:13.000000000 -0500
|
|
@@ -329,7 +329,8 @@
|
|
pthread_cond_signal(&init_cond);
|
|
pthread_mutex_unlock(&init_lock);
|
|
|
|
- return (void*) event_base_loop(me->base, 0);
|
|
+ event_base_loop(me->base, 0);
|
|
+ return NULL;
|
|
}
|
|
|
|
|