commit 35bcb9ec31d8f3993c2ecf362471ef939e27e58d
parent 0626d3edb39afb720cc0aadd1b141d6112aae1e3
Author: William Casarin <jb55@jb55.com>
Date: Tue, 25 Jul 2023 20:02:02 -0700
ndb: switch to enum for tce types
Let's help the swift compiler out a bit
Diffstat:
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/nostrdb.h b/nostrdb.h
@@ -4,17 +4,19 @@
#include <inttypes.h>
#include "cursor.h"
-// To-client event types
-#define NDB_TCE_EVENT 0x1
-#define NDB_TCE_OK 0x2
-#define NDB_TCE_NOTICE 0x3
-#define NDB_TCE_EOSE 0x4
-
#define NDB_PACKED_STR 0x1
#define NDB_PACKED_ID 0x2
struct ndb_json_parser;
+// To-client event types
+enum tce_type {
+ NDB_TCE_EVENT = 0x1,
+ NDB_TCE_OK = 0x2,
+ NDB_TCE_NOTICE = 0x3,
+ NDB_TCE_EOSE = 0x4,
+};
+
struct ndb_str {
unsigned char flag;
union {
@@ -36,7 +38,7 @@ struct ndb_command_result {
// To-client event
struct ndb_tce {
- int evtype;
+ enum tce_type evtype;
const char *subid;
int subid_len;