This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Neels Hofmeyr nhofmeyr at sysmocom.dediff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c index 208b623..1d9c6d5 100644 --- a/openbsc/src/gprs/gtphub.c +++ b/openbsc/src/gprs/gtphub.c @@ -41,6 +41,8 @@ void *osmo_gtphub_ctx; #define LOG(fmt, args...) \ LOGP(DGTPHUB, LOGL_NOTICE, fmt, ##args) +#define ZERO_STRUCT(struct_pointer) memset(struct_pointer, '\0', sizeof(*(struct_pointer))) + /* TODO move this to osmocom/core/select.h ? */ typedef int (*osmo_fd_cb_t)(struct osmo_fd *fd, unsigned int what); @@ -182,7 +184,7 @@ void validate_gtp_header(struct gtp_packet_desc *p) * error, p->rc is set <= 0 (see enum gtp_rc). */ static void gtp_decode(const uint8_t *data, int data_len, struct gtp_packet_desc *res) { - memset(res, '\0', sizeof(*res)); + ZERO_STRUCT(res); res->data = (union gtp_packet*)data; res->data_len = data_len; @@ -221,7 +223,7 @@ uint32_t tei_pool_next(struct tei_pool *pool) void tei_map_init(struct tei_map *map, struct tei_pool *pool) { - *map = (struct tei_map){}; + ZERO_STRUCT(map); map->pool = pool; INIT_LLIST_HEAD(&map->mappings); } @@ -283,7 +285,7 @@ void tei_map_del(struct tei_map *map, uint32_t tei_orig) void gtphub_zero(struct gtphub *hub) { - memset(hub, '\0', sizeof(*hub)); + ZERO_STRUCT(hub); } static int gtphub_sock_init(struct osmo_fd *ofd, @@ -316,7 +318,7 @@ static int gtphub_gtp_bind_init(struct gtphub_bind *b, osmo_fd_cb_t cb, void *cb_data, unsigned int ofd_id) { - memset(b, '\0', sizeof(*b)); + ZERO_STRUCT(b); tei_pool_init(&b->teip); INIT_LLIST_HEAD(&b->peers); -- 2.1.4