Browse Source

- Fix compiler warnings

master
decke 7 years ago
parent
commit
7272d877bc
3 changed files with 7 additions and 5 deletions
  1. 1
    1
      Makefile
  2. 2
    2
      client.h
  3. 4
    2
      leveldb.c

+ 1
- 1
Makefile View File

@@ -5,7 +5,7 @@
LOCALBASE?=/usr/local

# Development flags
.if defined(DEBUG)
.if !defined(NODEBUG)
CFLAGS+=-g -Wall -DDEBUG
.endif


+ 2
- 2
client.h View File

@@ -81,8 +81,8 @@ TAILQ_HEAD(, client) clients;

struct queue {
char *queuename;
volatile int read;
volatile int write;
volatile u_int read;
volatile u_int write;

TAILQ_HEAD(, client) subscribers;
TAILQ_ENTRY(queue) entries;

+ 4
- 2
leveldb.c View File

@@ -91,6 +91,8 @@ int leveldb_free(void)
leveldb_writeoptions_destroy(woptions);
leveldb_cache_destroy(cache);
leveldb_env_destroy(env);

return 0;
}


@@ -110,14 +112,14 @@ int leveldb_add_message(struct queue *queue, char *message)
seq = atomic_fetchadd_int(&queue->write, 1);
wb = leveldb_writebatch_create();

snprintf(key, sizeof(key)-1, "%s.%ld", queue->queuename, seq);
snprintf(key, sizeof(key)-1, "%s.%d", queue->queuename, seq);
key[sizeof(key)-1] = '\0';
leveldb_writebatch_put(wb, key, strlen(key), message, strlen(message));

snprintf(key, sizeof(key)-1, "%s.write", queue->queuename);
key[sizeof(key)-1] = '\0';
sprintf(value, "%s", seq);
sprintf(value, "%d", seq);
leveldb_writebatch_put(wb, key, strlen(key), value, strlen(value));

leveldb_write(db, woptions, wb, &error);

Loading…
Cancel
Save