summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp37sitdu, corvid <devnull@localhost>2013-01-12 20:13:36 +0000
committerp37sitdu, corvid <devnull@localhost>2013-01-12 20:13:36 +0000
commit0f0e7cc54aecab1647bdcd222c84d17275b92313 (patch)
tree225d4a6128cd2ddbc1f762b0355c986f12c13730
parent69666a2dafc8a00e5029f4b671ed94d5be38e109 (diff)
clean up struct typedefs
-rw-r--r--dlib/dlib.h8
-rw-r--r--dpi/ftp.c2
-rw-r--r--dpip/dpip.h5
-rw-r--r--src/bitvec.h6
-rw-r--r--src/bw.h8
-rw-r--r--src/cache.h5
-rw-r--r--src/chain.h10
-rw-r--r--src/decode.h10
-rw-r--r--src/dicache.c5
-rw-r--r--src/dicache.h8
-rw-r--r--src/dns.h4
-rw-r--r--src/domain.c2
-rw-r--r--src/gif.c2
-rw-r--r--src/html_common.hh11
-rw-r--r--src/jpeg.c10
-rw-r--r--src/klist.h11
-rw-r--r--src/misc.c2
-rw-r--r--src/nav.c6
-rw-r--r--src/png.c3
-rw-r--r--src/prefs.h6
-rw-r--r--src/prefsparser.cc2
-rw-r--r--src/url.h6
22 files changed, 53 insertions, 79 deletions
diff --git a/dlib/dlib.h b/dlib/dlib.h
index 0d194dbe..87335e00 100644
--- a/dlib/dlib.h
+++ b/dlib/dlib.h
@@ -99,7 +99,7 @@ int dStrnAsciiCasecmp(const char *s1, const char *s2, size_t n);
*/
#define Dstr_char_t char
-typedef struct _dstr {
+typedef struct {
int sz; /* allocated size (private) */
int len;
Dstr_char_t *str;
@@ -128,13 +128,11 @@ const char *dStr_printable(Dstr *in, int maxlen);
/*
*-- dList --------------------------------------------------------------------
*/
-struct Dlist_ {
+typedef struct {
int sz; /* allocated size (private) */
int len;
void **list;
-};
-
-typedef struct Dlist_ Dlist;
+} Dlist;
/* dCompareFunc:
* Return: 0 if parameters are equal (for dList_find_custom).
diff --git a/dpi/ftp.c b/dpi/ftp.c
index 288f993c..fa64eb6e 100644
--- a/dpi/ftp.c
+++ b/dpi/ftp.c
@@ -62,7 +62,7 @@ static char **dl_argv = NULL;
/*---------------------------------------------------------------------------*/
/* TODO: could use dStr ADT! */
-typedef struct ContentType_ {
+typedef struct {
const char *str;
int len;
} ContentType_t;
diff --git a/dpip/dpip.h b/dpip/dpip.h
index 083732ff..1a1846df 100644
--- a/dpip/dpip.h
+++ b/dpip/dpip.h
@@ -28,8 +28,7 @@ typedef enum {
/*
* Dpip socket handler type.
*/
-typedef struct _DpipSocketHandler Dsh;
-struct _DpipSocketHandler {
+typedef struct {
int fd_in;
int fd_out;
/* FILE *in; --Unused. The stream functions block when reading. */
@@ -41,7 +40,7 @@ struct _DpipSocketHandler {
int mode; /* mode flags: DPIP_TAG | DPIP_LAST_TAG | DPIP_RAW */
int status; /* status code: DPIP_EAGAIN | DPIP_ERROR | DPIP_EOF */
-};
+} Dsh;
/*
diff --git a/src/bitvec.h b/src/bitvec.h
index f9063070..d2f6d9e1 100644
--- a/src/bitvec.h
+++ b/src/bitvec.h
@@ -6,12 +6,10 @@
#define BVEC_TYPE uchar_t
#define BVEC_SIZE sizeof(BVEC_TYPE)
-typedef struct _bitvec bitvec_t;
-
-struct _bitvec {
+typedef struct {
BVEC_TYPE *vec;
int len; /* number of bits [1 based] */
-};
+} bitvec_t;
/*
diff --git a/src/bw.h b/src/bw.h
index 590af4fb..e07c9c34 100644
--- a/src/bw.h
+++ b/src/bw.h
@@ -11,12 +11,8 @@
#define BW_Force (4) /* Stop connection too */
-typedef struct _BrowserWindow BrowserWindow;
-
-
/* browser_window contains the specific data for a single window */
-struct _BrowserWindow
-{
+typedef struct {
/* Pointer to the UI object this bw belongs to */
void *ui;
@@ -61,7 +57,7 @@ struct _BrowserWindow
/* HTML-bugs detected at parse time */
int num_page_bugs;
Dstr *page_bugs;
-};
+} BrowserWindow;
#ifdef __cplusplus
diff --git a/src/cache.h b/src/cache.h
index c01bec55..c39e4600 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -34,16 +34,17 @@ extern "C" {
#define CA_HugeFile 0x1000 /* URL content is too big */
#define CA_IsEmpty 0x2000 /* True until a byte of content arrives */
+typedef struct CacheClient CacheClient_t;
+
/*
* Callback type for cache clients
*/
-typedef struct _CacheClient CacheClient_t;
typedef void (*CA_Callback_t)(int Op, CacheClient_t *Client);
/*
* Data structure for cache clients.
*/
-struct _CacheClient {
+struct CacheClient {
int Key; /* Primary Key for this client */
const DilloUrl *Url; /* Pointer to a cache entry Url */
int Version; /* Dicache version of this Url (0 if not used) */
diff --git a/src/chain.h b/src/chain.h
index fd86557c..10957dc3 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -29,14 +29,12 @@
#define FWD 1
#define BCK 2
-
-typedef struct _ChainLink ChainLink;
-typedef struct _DataBuf DataBuf;
+typedef struct ChainLink ChainLink;
typedef void (*ChainFunction_t)(int Op, int Branch, int Dir, ChainLink *Info,
void *Data1, void *Data2);
/* This is the main data structure for CCC nodes */
-struct _ChainLink {
+struct ChainLink {
void *LocalKey;
int Flags;
@@ -51,11 +49,11 @@ struct _ChainLink {
};
/* A convenience data structure for passing data chunks between nodes */
-struct _DataBuf {
+typedef struct {
char *Buf;
int Size;
int Code;
-};
+} DataBuf;
diff --git a/src/decode.h b/src/decode.h
index 064177eb..279807a6 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -7,15 +7,13 @@
extern "C" {
#endif /* __cplusplus */
-typedef struct _Decode Decode;
-
-struct _Decode {
+typedef struct Decode {
char *buffer;
Dstr *leftover;
void *state;
- Dstr *(*decode) (Decode *dc, const char *instr, int inlen);
- void (*free) (Decode *dc);
-};
+ Dstr *(*decode) (struct Decode *dc, const char *instr, int inlen);
+ void (*free) (struct Decode *dc);
+} Decode;
Decode *a_Decode_transfer_init(const char *format);
Decode *a_Decode_content_init(const char *format);
diff --git a/src/dicache.c b/src/dicache.c
index e700f000..23721685 100644
--- a/src/dicache.c
+++ b/src/dicache.c
@@ -21,7 +21,6 @@
#include "dgif.h"
#include "djpeg.h"
-typedef struct _DICacheNode DICacheNode;
enum {
DIC_Gif,
@@ -29,11 +28,11 @@ enum {
DIC_Jpeg
};
-struct _DICacheNode {
+typedef struct {
int valid; /* flag */
DilloUrl *url; /* primary "Key" for this dicache entry */
DICacheEntry *first; /* pointer to the first dicache entry in this list */
-};
+} DICacheNode;
/*
* List of DICacheNode. One node per URL. Each node may have several
diff --git a/src/dicache.h b/src/dicache.h
index 70adb6c0..76fdba92 100644
--- a/src/dicache.h
+++ b/src/dicache.h
@@ -24,9 +24,7 @@ typedef enum {
DIC_Abort /* Image transfer aborted */
} DicEntryState;
-typedef struct _DICacheEntry DICacheEntry;
-
-struct _DICacheEntry {
+typedef struct DICacheEntry {
DilloUrl *url; /* Image URL for this entry */
uint_t width, height; /* As taken from image data */
DilloImgType type; /* Image type */
@@ -44,8 +42,8 @@ struct _DICacheEntry {
void *DecoderData; /* Client function data */
uint_t DecodedSize; /* Size of already decoded data */
- DICacheEntry *next; /* Link to the next "newer" version */
-};
+ struct DICacheEntry *next; /* Link to the next "newer" version */
+} DICacheEntry;
void a_Dicache_init (void);
diff --git a/src/dns.h b/src/dns.h
index 70c0b8dc..61ae6410 100644
--- a/src/dns.h
+++ b/src/dns.h
@@ -20,12 +20,12 @@ void a_Dns_resolve(const char *hostname, DnsCallback_t cb_func, void *cb_data);
# define DILLO_ADDR_MAX sizeof(struct in_addr)
#endif
-typedef struct _DilloHost
-{
+typedef struct {
int af;
int alen;
char data[DILLO_ADDR_MAX];
} DilloHost;
+
void a_Dns_dillohost_to_string(DilloHost *host, char *dst, size_t size);
#ifdef __cplusplus
diff --git a/src/domain.c b/src/domain.c
index 90d6b414..be5d2221 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -14,7 +14,7 @@
#include "list.h"
#include "domain.h"
-typedef struct Rule {
+typedef struct {
char *origin;
char *destination;
} Rule;
diff --git a/src/gif.c b/src/gif.c
index 61407982..554ffa83 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -79,7 +79,7 @@
#define MAX_LWZ_BITS 12
-typedef struct _DilloGif {
+typedef struct {
DilloImage *Image;
DilloUrl *url;
int version;
diff --git a/src/html_common.hh b/src/html_common.hh
index a89e1cb5..cdb856db 100644
--- a/src/html_common.hh
+++ b/src/html_common.hh
@@ -39,9 +39,6 @@
* Typedefs
*/
-typedef struct _DilloHtmlImage DilloHtmlImage;
-typedef struct _DilloHtmlState DilloHtmlState;
-
typedef enum {
DT_NONE,
DT_HTML,
@@ -94,12 +91,12 @@ typedef enum {
* Data Structures
*/
-struct _DilloHtmlImage {
+typedef struct {
DilloUrl *url;
DilloImage *image;
-};
+} DilloHtmlImage;
-struct _DilloHtmlState {
+typedef struct {
DilloHtmlParseMode parse_mode;
DilloHtmlTableMode table_mode;
DilloHtmlTableBorderMode table_border_mode;
@@ -120,7 +117,7 @@ struct _DilloHtmlState {
have to be "handed over" (see Html_add_indented and
Html_eventually_pop_dw). */
bool hand_over_break;
-};
+} DilloHtmlState;
/*
* Classes
diff --git a/src/jpeg.c b/src/jpeg.c
index b99d0bc7..c81afe1d 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -46,20 +46,22 @@ typedef enum {
DILLO_JPEG_ERROR
} DilloJpegState;
+typedef struct DilloJpeg DilloJpeg;
+
/* An implementation of a suspending source manager */
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
- struct DilloJpeg *jpeg; /* a pointer back to the jpeg object */
+ DilloJpeg *jpeg; /* a pointer back to the jpeg object */
} my_source_mgr;
struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
};
-typedef struct my_error_mgr * my_error_ptr;
+typedef struct my_error_mgr *my_error_ptr;
-typedef struct DilloJpeg {
+struct DilloJpeg {
DilloImage *Image;
DilloUrl *url;
int version;
@@ -74,7 +76,7 @@ typedef struct DilloJpeg {
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
-} DilloJpeg;
+};
/*
* Forward declarations
diff --git a/src/klist.h b/src/klist.h
index 53b2bc31..04e14d33 100644
--- a/src/klist.h
+++ b/src/klist.h
@@ -8,19 +8,16 @@
extern "C" {
#endif /* __cplusplus */
-typedef struct _KlistNode KlistNode_t;
-typedef struct _Klist Klist_t;
-
-struct _KlistNode {
+typedef struct {
int Key; /* primary key */
void *Data; /* data reference */
-};
+} KlistNode_t;
-struct _Klist {
+typedef struct {
Dlist *List;
int Clean; /* check flag */
int Counter; /* counter (for making keys) */
-};
+} Klist_t;
/*
diff --git a/src/misc.c b/src/misc.c
index 0181a125..3e8496e5 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -97,7 +97,7 @@ a_Misc_expand_tabs(char **start, char *end, char *buf, int buflen)
}
/* TODO: could use dStr ADT! */
-typedef struct ContentType_ {
+typedef struct {
const char *str;
int len;
} ContentType_t;
diff --git a/src/nav.c b/src/nav.c
index 2e4f2233..4ccb28be 100644
--- a/src/nav.c
+++ b/src/nav.c
@@ -27,12 +27,10 @@
* For back and forward navigation, each bw keeps an url index,
* and its scroll position.
*/
-typedef struct _nav_stack_item nav_stack_item;
-struct _nav_stack_item
-{
+typedef struct {
int url_idx;
int posx, posy;
-};
+} nav_stack_item;
diff --git a/src/png.c b/src/png.c
index 3bf79db7..995725cd 100644
--- a/src/png.c
+++ b/src/png.c
@@ -58,8 +58,7 @@ static char *prog_state_name[] =
* ones for XBM and PNM are.
*/
-typedef
-struct _DilloPng {
+typedef struct {
DilloImage *Image; /* Image meta data */
DilloUrl *url; /* Primary Key for the dicache */
int version; /* Secondary Key for the dicache */
diff --git a/src/prefs.h b/src/prefs.h
index 68bf773a..2b0f15e4 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -26,9 +26,7 @@ extern "C" {
/* Panel sizes */
enum { P_tiny = 0, P_small, P_medium };
-typedef struct _DilloPrefs DilloPrefs;
-
-struct _DilloPrefs {
+typedef struct {
int width;
int height;
int xpos;
@@ -99,7 +97,7 @@ struct _DilloPrefs {
bool_t middle_click_drags_page;
int penalty_hyphen, penalty_hyphen_2;
int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
-};
+} DilloPrefs;
/* Global Data */
extern DilloPrefs prefs;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index 55c5b5e4..74444bd8 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -35,7 +35,7 @@ typedef enum {
PREFS_PANEL_SIZE
} PrefType_t;
-typedef struct SymNode_ {
+typedef struct {
const char *name;
void *pref;
PrefType_t type;
diff --git a/src/url.h b/src/url.h
index c5f70615..bb20d789 100644
--- a/src/url.h
+++ b/src/url.h
@@ -84,13 +84,11 @@
#define URL_ILLEGAL_CHARS_SPC(u) URL_ILLEGAL_CHARS_SPC_(u)
-typedef struct _DilloUrl DilloUrl;
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-struct _DilloUrl {
+typedef struct {
Dstr *url_string;
const char *buffer;
const char *scheme; /**/
@@ -106,7 +104,7 @@ struct _DilloUrl {
int ismap_url_len; /* Used by server side image maps */
int illegal_chars; /* number of illegal chars */
int illegal_chars_spc; /* number of illegal space chars */
-};
+} DilloUrl;
DilloUrl* a_Url_new(const char *url_str, const char *base_url);