2024-06-23 16:27:51 +02:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2024-06-27 01:21:25 +02:00
|
|
|
#include <stdio.h>
|
2024-06-23 16:27:51 +02:00
|
|
|
|
|
|
|
#define rb_size_t size_t
|
|
|
|
#include "ringbuf.h"
|
|
|
|
|
2024-06-27 00:05:49 +02:00
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2024-06-23 16:27:51 +02:00
|
|
|
struct RingBuf rb;
|
|
|
|
rb_init(&rb, 10, malloc, sizeof(int));
|
|
|
|
|
2024-06-30 05:08:42 +02:00
|
|
|
int data = 5;
|
|
|
|
|
|
|
|
rb_push_back(&rb, &data, memcpy);
|
|
|
|
|
|
|
|
int d;
|
|
|
|
rb_pop_front(&rb, &d);
|
|
|
|
|
|
|
|
printf("Data: %d\n", d);
|
2024-06-27 01:21:25 +02:00
|
|
|
|
|
|
|
rb_destroy(&rb, free);
|
2024-06-23 16:27:51 +02:00
|
|
|
|
|
|
|
return 0;
|
2024-06-27 00:05:49 +02:00
|
|
|
}
|