NeoMutt  2025-01-09-156-g99fdbd
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
store.c File Reference

Shared store code. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "lib.h"
+ Include dependency graph for store.c:

Go to the source code of this file.

Macros

#define STORE_BACKEND(name)   extern const struct StoreOps store_##name##_ops;
 

Functions

struct Sliststore_backend_list (void)
 Get a list of backend names.
 
const struct StoreOpsstore_get_backend_ops (const char *str)
 Get the API functions for an store backend.
 
bool store_is_valid_backend (const char *str)
 Is the string a valid Store backend.
 

Variables

static const struct StoreOpsStoreOps []
 Backend implementations.
 

Detailed Description

Shared store code.

Authors
  • Pietro Cerutti
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file store.c.

Macro Definition Documentation

◆ STORE_BACKEND

#define STORE_BACKEND (   name)    extern const struct StoreOps store_##name##_ops;

Definition at line 37 of file store.c.

Function Documentation

◆ store_backend_list()

struct Slist * store_backend_list ( void  )

Get a list of backend names.

Return values
ptrList of names
Note
Caller should free the Slist

Definition at line 85 of file store.c.

86{
87 struct Slist *sl = slist_new(D_SLIST_SEP_SPACE);
88
89 const struct StoreOps **store_ops = StoreOps;
90
91 for (; *store_ops; store_ops++)
92 {
93 slist_add_string(sl, (*store_ops)->name);
94 }
95
96 return sl;
97}
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:68
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition: slist.c:51
static const struct StoreOps * StoreOps[]
Backend implementations.
Definition: store.c:51
String list.
Definition: slist.h:37
Definition: lib.h:69
#define D_SLIST_SEP_SPACE
Slist items are space-separated.
Definition: types.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store_get_backend_ops()

const struct StoreOps * store_get_backend_ops ( const char *  str)

Get the API functions for an store backend.

Parameters
strName of the Store
Return values
ptrSet of function pointers

Definition at line 104 of file store.c.

105{
106 const struct StoreOps **store_ops = StoreOps;
107
108 if (!str || (*str == '\0'))
109 {
110 return *store_ops;
111 }
112
113 for (; *store_ops; store_ops++)
114 if (mutt_str_equal(str, (*store_ops)->name))
115 break;
116
117 return *store_ops;
118}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:661
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store_is_valid_backend()

bool store_is_valid_backend ( const char *  str)

Is the string a valid Store backend.

Parameters
strStore name
Return values
trues is recognized as a valid backend
falseotherwise

Definition at line 126 of file store.c.

127{
128 return store_get_backend_ops(str);
129}
const struct StoreOps * store_get_backend_ops(const char *str)
Get the API functions for an store backend.
Definition: store.c:104
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ StoreOps

const struct StoreOps* StoreOps[]
static
Initial value:
= {
&store_tokyocabinet_ops,
&store_kyotocabinet_ops,
&store_qdbm_ops,
&store_gdbm_ops,
&store_bdb_ops,
&store_tdb_ops,
&store_lmdb_ops,
NULL,
}

Backend implementations.

Definition at line 51 of file store.c.