// Index messages by EUID per room.
//
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2023 by the citadel.org team
//
// This program is open source software. Use, duplication, or disclosure
// is subject to the terms of the GNU General Public License, version 3.
long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf) {
char *key;
int key_len;
- struct cdbdata *cdb_euid;
+ struct cdbdata cdb_euid;
long msgnum = (-1L);
syslog(LOG_DEBUG, "euidindex: searching for EUID <%s> in <%s>", euid, qrbuf->QRname);
cdb_euid = cdb_fetch(CDB_EUIDINDEX, key, key_len);
free(key);
- if (cdb_euid == NULL) {
+ if (cdb_euid.len == 0) {
msgnum = (-1L);
}
else {
// The first (sizeof long) of the record is what we're looking for. Throw away the rest.
- memcpy(&msgnum, cdb_euid->ptr, sizeof(long));
- cdb_free(cdb_euid);
+ memcpy(&msgnum, cdb_euid.ptr, sizeof(long));
}
syslog(LOG_DEBUG, "euidindex: returning msgnum = %ld", msgnum);
return(msgnum);