src/timestamp.c
author us@chu.huenfield.org
Tue, 25 Dec 2018 14:46:45 +0100
branchsync
changeset 3209 c15b4ca2b52a
parent 2381 c01f2e8f3582
child 3832 8860f25e9be9
permissions -rw-r--r--
Replace use of Sequoia's backend with a custom key store.

- Sequoia's key store doesn't meet pep's needs (in particular, the
ability to search on a key's user id) and trying to shoehorn pep's
needs onto Sequoia's key store abstractions is just introducing
overhead with no appreciable gain in functionality.

- This patch changes the Sequoia backend to use a local sqlite
database to store the public keys.
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #include "pEp_internal.h"
     5 
     6 #include "timestamp.h"
     7 
     8 #include <stdlib.h>
     9 #include <string.h>
    10 #include <assert.h>
    11 
    12 DYNAMIC_API timestamp * new_timestamp(time_t clock)
    13 {
    14     timestamp *ts = calloc(1, sizeof(timestamp));
    15     assert(ts);
    16     if (ts == NULL)
    17         return NULL;
    18 
    19     if (clock)
    20         gmtime_r(&clock, ts);
    21 
    22     return ts;
    23 }
    24 
    25 
    26 DYNAMIC_API void free_timestamp(timestamp *ts)
    27 {
    28     free(ts);
    29 }
    30 
    31 DYNAMIC_API timestamp * timestamp_dup(const timestamp *src)
    32 {
    33     assert(src);
    34     if (!src)
    35         return NULL;
    36 
    37     timestamp *dst = malloc(sizeof(timestamp));
    38     assert(dst);
    39     if (!dst)
    40         return NULL;
    41 
    42     memcpy(dst, src, sizeof(timestamp));
    43     return dst;
    44 }
    45