1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

gcc4: conceal typedef in public header

Modern toolchains are fine with giving a typedef as a forward reference,
but gcc 4.3 can't cope with that and then seeing the real definition in the
.c later.

Just conceal the typedef and use the struct form for the forward reference
resolution type in the public header so even senior toolchains are happy.
This commit is contained in:
Andy Green 2022-02-18 08:25:58 +00:00
parent 058f97e687
commit 8b6f2d5dba
2 changed files with 10 additions and 8 deletions

View file

@ -43,7 +43,7 @@
//@{
typedef struct lws_map lws_map_t;
typedef struct lws_map_item lws_map_item_t;
struct lws_map_item;
typedef void * lws_map_key_t;
typedef void * lws_map_value_t;
@ -76,13 +76,13 @@ typedef struct lws_map_info {
} lws_map_info_t;
LWS_VISIBLE LWS_EXTERN const void *
lws_map_item_key(lws_map_item_t *_item);
lws_map_item_key(struct lws_map_item *_item);
LWS_VISIBLE LWS_EXTERN const void *
lws_map_item_value(lws_map_item_t *_item);
lws_map_item_value(struct lws_map_item *_item);
LWS_VISIBLE LWS_EXTERN size_t
lws_map_item_key_len(lws_map_item_t *_item);
lws_map_item_key_len(struct lws_map_item *_item);
LWS_VISIBLE LWS_EXTERN size_t
lws_map_item_value_len(lws_map_item_t *_item);
lws_map_item_value_len(struct lws_map_item *_item);
/*
* Helpers for C string keys case
@ -158,7 +158,7 @@ lws_map_destroy(lws_map_t **pmap);
* creating and adding the new one.
*/
LWS_VISIBLE LWS_EXTERN lws_map_item_t *
LWS_VISIBLE LWS_EXTERN struct lws_map_item *
lws_map_item_create(lws_map_t *map,
const lws_map_key_t key, size_t keylen,
const lws_map_value_t value, size_t valuelen);
@ -169,7 +169,7 @@ lws_map_item_create(lws_map_t *map,
* \param item: the item in the map to remove and free
*/
LWS_VISIBLE LWS_EXTERN void
lws_map_item_destroy(lws_map_item_t *item);
lws_map_item_destroy(struct lws_map_item *item);
/**
* lws_map_item_lookup() - look for a item with the given key in the map
@ -182,7 +182,7 @@ lws_map_item_destroy(lws_map_item_t *item);
* functions.
*/
LWS_VISIBLE LWS_EXTERN lws_map_item_t *
LWS_VISIBLE LWS_EXTERN struct lws_map_item *
lws_map_item_lookup(lws_map_t *map, const lws_map_key_t key, size_t keylen);
//@}

View file

@ -11,6 +11,8 @@
#include <libwebsockets.h>
typedef struct lws_map_item lws_map_item_t;
/* custom key and comparator for test 3 */
typedef struct mykey {