add function to return current registered provider
This commit is contained in:
parent
51079a8775
commit
c9ec48ded8
|
@ -81,13 +81,23 @@ struct codec_ctx {
|
|||
};
|
||||
|
||||
int sqlcipher_register_provider(sqlcipher_provider *p) {
|
||||
if(default_provider != NULL) {
|
||||
if(default_provider != NULL && default_provider != p) {
|
||||
/* only free the current registerd provider if it has been initialized
|
||||
and it isn't a pointer to the same provider passed to the function
|
||||
(i.e. protect against a caller calling register twice for the same provider) */
|
||||
sqlcipher_free(default_provider, sizeof(sqlcipher_provider));
|
||||
}
|
||||
default_provider = p;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/* return a pointer to the currently registered provider. This will
|
||||
allow an application to fetch the current registered provider and
|
||||
make minor changes to it */
|
||||
sqlcipher_provider* sqlcipher_get_provider() {
|
||||
return default_provider;
|
||||
}
|
||||
|
||||
void sqlcipher_activate() {
|
||||
sqlcipher_provider *p;
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
|
||||
|
|
|
@ -65,7 +65,9 @@ int sqlcipher_ismemset(const void *v, unsigned char value, int len);
|
|||
int sqlcipher_memcmp(const void *v0, const void *v1, int len);
|
||||
void sqlcipher_free(void *, int);
|
||||
|
||||
/* provider interfaces */
|
||||
int sqlcipher_register_provider(sqlcipher_provider *p);
|
||||
sqlcipher_provider* sqlcipher_get_provider();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue