commit 3eb35392e3362aa26d43b562b00c7b9b76205eb8
parent 8613ba33be77a9e6ad1c6cb685fa6fe91476022c
Author: William Casarin <jb55@jb55.com>
Date: Sun, 12 Jan 2025 17:43:01 -0800
refactor: use kind variable for clarity
almost no reason to do this, but whatever
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/nostrdb.c b/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);
}