aboutsummaryrefslogtreecommitdiff
path: root/lib/add-message.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-05-11 08:08:32 -0300
committerDavid Bremner <david@tethera.net>2021-05-14 06:38:19 -0300
commit929386fad90eed7dad8b32f457020c57a786d288 (patch)
treee38d784461c8e75352f8f84281f845d99b79297f /lib/add-message.cc
parent8410be8e0867820c9814d06b49ff6da822d384a3 (diff)
lib/generate_thread_id: move static buffer to notmuch_database_t
Work towards the goal of concurrent access to different Xapian databases from the same process.
Diffstat (limited to 'lib/add-message.cc')
-rw-r--r--lib/add-message.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/add-message.cc b/lib/add-message.cc
index 0c34d318..d4a00b17 100644
--- a/lib/add-message.cc
+++ b/lib/add-message.cc
@@ -40,17 +40,14 @@ parse_references (void *ctx,
static const char *
_notmuch_database_generate_thread_id (notmuch_database_t *notmuch)
{
- /* 16 bytes (+ terminator) for hexadecimal representation of
- * a 64-bit integer. */
- static char thread_id[17];
notmuch->last_thread_id++;
- sprintf (thread_id, "%016" PRIx64, notmuch->last_thread_id);
+ sprintf (notmuch->thread_id_str, "%016" PRIx64, notmuch->last_thread_id);
- notmuch->writable_xapian_db->set_metadata ("last_thread_id", thread_id);
+ notmuch->writable_xapian_db->set_metadata ("last_thread_id", notmuch->thread_id_str);
- return thread_id;
+ return notmuch->thread_id_str;
}
static char *