Changeset 08c48d7 in mod_gnutls for src/gnutls_util.c


Ignore:
Timestamp:
Jan 2, 2019, 3:22:48 PM (3 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, debian/master, master, proxy-ticket
Children:
4d38cbd
Parents:
c7710cf
Message:

Extract code for turning APR array of strings into gnutls_datum_t array

Having it as a separate function will allow sharing the code between
server and client (proxy) side ALPN proposal handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_util.c

    rc7710cf r08c48d7  
    182182    gnutls_priority_deinit(default_prio);
    183183}
     184
     185
     186
     187gnutls_datum_t * mgs_str_array_to_datum_array(const apr_array_header_t *src,
     188                                              apr_pool_t *pool,
     189                                              const int min_elements)
     190{
     191    int num = min_elements > src->nelts ? min_elements : src->nelts;
     192    gnutls_datum_t *dest = apr_palloc(pool, num * sizeof(gnutls_datum_t));
     193    for (int i = 0; i < src->nelts; i++)
     194    {
     195        dest[i].data = (void *) APR_ARRAY_IDX(src, i, char *);
     196        dest[i].size = strlen(APR_ARRAY_IDX(src, i, char *));
     197    }
     198    return dest;
     199}
Note: See TracChangeset for help on using the changeset viewer.