diff options
author | p37sitdu, corvid <devnull@localhost> | 2013-01-12 20:13:36 +0000 |
---|---|---|
committer | p37sitdu, corvid <devnull@localhost> | 2013-01-12 20:13:36 +0000 |
commit | 0f0e7cc54aecab1647bdcd222c84d17275b92313 (patch) | |
tree | 225d4a6128cd2ddbc1f762b0355c986f12c13730 /src | |
parent | 69666a2dafc8a00e5029f4b671ed94d5be38e109 (diff) |
clean up struct typedefs
Diffstat (limited to 'src')
-rw-r--r-- | src/bitvec.h | 6 | ||||
-rw-r--r-- | src/bw.h | 8 | ||||
-rw-r--r-- | src/cache.h | 5 | ||||
-rw-r--r-- | src/chain.h | 10 | ||||
-rw-r--r-- | src/decode.h | 10 | ||||
-rw-r--r-- | src/dicache.c | 5 | ||||
-rw-r--r-- | src/dicache.h | 8 | ||||
-rw-r--r-- | src/dns.h | 4 | ||||
-rw-r--r-- | src/domain.c | 2 | ||||
-rw-r--r-- | src/gif.c | 2 | ||||
-rw-r--r-- | src/html_common.hh | 11 | ||||
-rw-r--r-- | src/jpeg.c | 10 | ||||
-rw-r--r-- | src/klist.h | 11 | ||||
-rw-r--r-- | src/misc.c | 2 | ||||
-rw-r--r-- | src/nav.c | 6 | ||||
-rw-r--r-- | src/png.c | 3 | ||||
-rw-r--r-- | src/prefs.h | 6 | ||||
-rw-r--r-- | src/prefsparser.cc | 2 | ||||
-rw-r--r-- | src/url.h | 6 |
19 files changed, 47 insertions, 70 deletions
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; /* @@ -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); @@ -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; @@ -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 @@ -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; /* @@ -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; @@ -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; @@ -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; @@ -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); |