fixeria has submitted this change. (
https://gerrit.osmocom.org/c/libosmocore/+/32167 )
Change subject: core: remove unnecessary #include <osmocom/core/talloc.h>
......................................................................
core: remove unnecessary #include <osmocom/core/talloc.h>
Including this header just for TALLOC_CTX is an overkill, we use
'void *' for talloc contexts in nearly all other Osmocom projects.
Change-Id: I4b9ffd7a329081df3d2c0b0ee8698a3cf759e94e
Related: OS#5960
---
M include/osmocom/core/bitvec.h
M include/osmocom/core/strrb.h
M src/core/bitvec.c
M src/core/strrb.c
4 files changed, 18 insertions(+), 8 deletions(-)
Approvals:
Jenkins Builder: Verified
falconia: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h
index 70b0e27..1e2fe7b 100644
--- a/include/osmocom/core/bitvec.h
+++ b/include/osmocom/core/bitvec.h
@@ -23,7 +23,6 @@
* \file bitvec.h */
#include <stdint.h>
-#include <osmocom/core/talloc.h>
#include <osmocom/core/defs.h>
#include <stdbool.h>
@@ -61,7 +60,7 @@
int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit);
int bitvec_get_bytes(struct bitvec *bv, uint8_t *bytes, unsigned int count);
int bitvec_set_bytes(struct bitvec *bv, const uint8_t *bytes, unsigned int count);
-struct bitvec *bitvec_alloc(unsigned int size, TALLOC_CTX *bvctx);
+struct bitvec *bitvec_alloc(unsigned int size, void *bvctx);
void bitvec_free(struct bitvec *bv);
int bitvec_unhex(struct bitvec *bv, const char *src);
unsigned int bitvec_pack(const struct bitvec *bv, uint8_t *buffer);
diff --git a/include/osmocom/core/strrb.h b/include/osmocom/core/strrb.h
index e3d3201..92d6a2f 100644
--- a/include/osmocom/core/strrb.h
+++ b/include/osmocom/core/strrb.h
@@ -26,8 +26,6 @@
#include <stdbool.h>
#include <stdint.h>
-#include <osmocom/core/talloc.h>
-
/*! A structure representing an osmocom string ringbuffer */
#define RB_MAX_MESSAGE_SIZE 240
@@ -38,7 +36,7 @@
char **buffer; /*!< storage for messages */
};
-struct osmo_strrb *osmo_strrb_create(TALLOC_CTX * ctx, size_t rb_size);
+struct osmo_strrb *osmo_strrb_create(void *talloc_ctx, size_t rb_size);
bool osmo_strrb_is_empty(const struct osmo_strrb *rb);
const char *osmo_strrb_get_nth(const struct osmo_strrb *rb,
unsigned int string_index);
diff --git a/src/core/bitvec.c b/src/core/bitvec.c
index 350f738..38ea1bb 100644
--- a/src/core/bitvec.c
+++ b/src/core/bitvec.c
@@ -395,7 +395,7 @@
* \param[in] size Number of bytes in the vector
* \param[in] ctx Context from which to allocate
* \return pointer to allocated vector; NULL in case of error */
-struct bitvec *bitvec_alloc(unsigned int size, TALLOC_CTX *ctx)
+struct bitvec *bitvec_alloc(unsigned int size, void *ctx)
{
struct bitvec *bv = talloc(ctx, struct bitvec);
if (!bv)
diff --git a/src/core/strrb.c b/src/core/strrb.c
index df7edb3..c5a5ed6 100644
--- a/src/core/strrb.c
+++ b/src/core/strrb.c
@@ -52,12 +52,12 @@
* This function creates and initializes a ringbuffer.
* Note that the ringbuffer stores at most rb_size - 1 messages.
*/
-struct osmo_strrb *osmo_strrb_create(TALLOC_CTX * ctx, size_t rb_size)
+struct osmo_strrb *osmo_strrb_create(void *talloc_ctx, size_t rb_size)
{
struct osmo_strrb *rb = NULL;
unsigned int i;
- rb = talloc_zero(ctx, struct osmo_strrb);
+ rb = talloc_zero(talloc_ctx, struct osmo_strrb);
if (!rb)
goto alloc_error;
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/32167
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4b9ffd7a329081df3d2c0b0ee8698a3cf759e94e
Gerrit-Change-Number: 32167
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged