Ignore:
Timestamp:
04/10/14 01:24:05 (8 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
df668eb
Parents:
fb1fd42
Message:

Use size_t rather than int for the data structures. Export vector, deque and ring_buffer for testing and use in programs.
Remove some inlines for now since these result in lots of compile warnings when also exported, the compiler is probably smart enough anyway.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/data-struct/ring_buffer.c

    rd6a56b6 read9478  
    5353 *                              NOTE: this mainly applies to the blocking functions
    5454 */
    55 inline void libtrace_ringbuffer_init(libtrace_ringbuffer_t * rb, int size, int mode) {
     55DLLEXPORT void libtrace_ringbuffer_init(libtrace_ringbuffer_t * rb, size_t size, int mode) {
    5656        size = size + 1;
    5757        assert (size > 1);
     
    8888 * @param rb The ringbuffer to destroy
    8989 */
    90 inline void libtrace_ringbuffer_destroy(libtrace_ringbuffer_t * rb) {
     90DLLEXPORT void libtrace_ringbuffer_destroy(libtrace_ringbuffer_t * rb) {
    9191#if USE_LOCK_TYPE == LOCK_TYPE_SPIN
    9292        assert(pthread_spin_destroy(&rb->swlock) == 0);
     
    116116 * write/read try instead.
    117117 */
    118 inline int libtrace_ringbuffer_is_empty(const libtrace_ringbuffer_t * rb) {
     118DLLEXPORT int libtrace_ringbuffer_is_empty(const libtrace_ringbuffer_t * rb) {
    119119        return rb->start == rb->end;
    120120}
     
    125125 * write/read try instead.
    126126 */
    127 inline int libtrace_ringbuffer_is_full(const libtrace_ringbuffer_t * rb) {
     127DLLEXPORT int libtrace_ringbuffer_is_full(const libtrace_ringbuffer_t * rb) {
    128128#if USE_MODULUS
    129129        return rb->start == ((rb->end + 1) % rb->size);
     
    143143 * @param value the value to store
    144144 */
    145 inline void libtrace_ringbuffer_write(libtrace_ringbuffer_t * rb, void* value) {
     145DLLEXPORT void libtrace_ringbuffer_write(libtrace_ringbuffer_t * rb, void* value) {
    146146        /* Need an empty to start with */
    147147        if (rb->mode == LIBTRACE_RINGBUFFER_BLOCKING)
     
    180180 * @return 1 if a object was written otherwise 0.
    181181 */
    182 inline int libtrace_ringbuffer_try_write(libtrace_ringbuffer_t * rb, void* value) {
     182DLLEXPORT int libtrace_ringbuffer_try_write(libtrace_ringbuffer_t * rb, void* value) {
    183183        if (libtrace_ringbuffer_is_full(rb))
    184184                return 0;
     
    194194 * @return The object that was read
    195195 */
    196 inline void* libtrace_ringbuffer_read(libtrace_ringbuffer_t *rb) {
     196DLLEXPORT void* libtrace_ringbuffer_read(libtrace_ringbuffer_t *rb) {
    197197        void* value;
    198198       
     
    228228 * @return 1 if a object was received otherwise 0, in this case out remains unchanged
    229229 */
    230 inline int libtrace_ringbuffer_try_read(libtrace_ringbuffer_t *rb, void ** value) {
     230DLLEXPORT int libtrace_ringbuffer_try_read(libtrace_ringbuffer_t *rb, void ** value) {
    231231        if (libtrace_ringbuffer_is_empty(rb))
    232232                return 0;
     
    238238 * A thread safe version of libtrace_ringbuffer_write
    239239 */
    240 inline void libtrace_ringbuffer_swrite(libtrace_ringbuffer_t * rb, void* value) {
     240DLLEXPORT void libtrace_ringbuffer_swrite(libtrace_ringbuffer_t * rb, void* value) {
    241241        LOCK(w);
    242242        libtrace_ringbuffer_write(rb, value);
     
    247247 * A thread safe version of libtrace_ringbuffer_try_write
    248248 */
    249 inline int libtrace_ringbuffer_try_swrite(libtrace_ringbuffer_t * rb, void* value) {
     249DLLEXPORT int libtrace_ringbuffer_try_swrite(libtrace_ringbuffer_t * rb, void* value) {
    250250        int ret;
    251251#if USE_CHECK_EARLY
     
    266266 * and libtrace_ringbuffer_try_swrite are being used.
    267267 */
    268 inline int libtrace_ringbuffer_try_swrite_bl(libtrace_ringbuffer_t * rb, void* value) {
     268DLLEXPORT int libtrace_ringbuffer_try_swrite_bl(libtrace_ringbuffer_t * rb, void* value) {
    269269        int ret;
    270270#if USE_CHECK_EARLY
     
    281281 * A thread safe version of libtrace_ringbuffer_read
    282282 */
    283 inline void * libtrace_ringbuffer_sread(libtrace_ringbuffer_t *rb) {
     283DLLEXPORT void * libtrace_ringbuffer_sread(libtrace_ringbuffer_t *rb) {
    284284        void* value;
    285285        LOCK(r);
     
    292292 * A thread safe version of libtrace_ringbuffer_try_write
    293293 */
    294 inline int libtrace_ringbuffer_try_sread(libtrace_ringbuffer_t *rb, void ** value) {
     294DLLEXPORT int libtrace_ringbuffer_try_sread(libtrace_ringbuffer_t *rb, void ** value) {
    295295        int ret;
    296296#if USE_CHECK_EARLY
     
    311311 * and libtrace_ringbuffer_try_sread are being used.
    312312 */
    313 inline int libtrace_ringbuffer_try_sread_bl(libtrace_ringbuffer_t *rb, void ** value) {
     313DLLEXPORT int libtrace_ringbuffer_try_sread_bl(libtrace_ringbuffer_t *rb, void ** value) {
    314314        int ret;
    315315#if USE_CHECK_EARLY
     
    323323}
    324324
    325 inline void libtrace_zero_ringbuffer(libtrace_ringbuffer_t * rb)
     325DLLEXPORT void libtrace_zero_ringbuffer(libtrace_ringbuffer_t * rb)
    326326{
    327327        rb->start = 0;
Note: See TracChangeset for help on using the changeset viewer.