commit 27f55bc09f41ff1e3035e6275ae7cc0d0eed949a
parent 52845a52bb6a4c8d240e91add166e412a789a31d
Author: William Casarin <jb55@jb55.com>
Date: Sun, 12 Jan 2025 17:43:01 -0800
nostrdb: refactor: use kind variable for clarity
almost no reason to do this, but whatever
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c
@@ -4141,10 +4141,12 @@ static uint64_t ndb_write_note(struct ndb_txn *txn,
uint32_t ndb_flags)
{
int rc;
- uint64_t note_key;
+ uint64_t note_key, kind;
MDB_dbi note_db;
MDB_val key, val;
+ kind = note->note->kind;
+
// let's quickly sanity check if we already have this note
if (ndb_get_notekey_by_id(txn, note->note->id))
return 0;
@@ -4173,7 +4175,7 @@ static uint64_t ndb_write_note(struct ndb_txn *txn,
ndb_write_note_pubkey_kind_index(txn, note->note, note_key);
// only parse content and do fulltext index on text and longform notes
- if (note->note->kind == 1 || note->note->kind == 30023) {
+ if (kind == 1 || kind == 30023) {
if (!ndb_flag_set(ndb_flags, NDB_FLAG_NO_FULLTEXT)) {
if (!ndb_write_note_fulltext_index(txn, note->note, note_key))
return 0;
@@ -4183,9 +4185,7 @@ static uint64_t ndb_write_note(struct ndb_txn *txn,
if (!ndb_flag_set(ndb_flags, NDB_FLAG_NO_NOTE_BLOCKS)) {
ndb_write_new_blocks(txn, note->note, note_key, scratch, scratch_size);
}
- }
-
- if (note->note->kind == 7 && !ndb_flag_set(ndb_flags, NDB_FLAG_NO_STATS)) {
+ } else if (kind == 7 && !ndb_flag_set(ndb_flags, NDB_FLAG_NO_STATS)) {
ndb_write_reaction_stats(txn, note->note);
}