From 4c73d29c06a858d5cbbe314df570ac03695fae3f Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Fri, 8 Nov 2013 17:13:10 +0100 Subject: hexdump: Rename struct _pr to struct hexdump_pr and remove it's typedef Signed-off-by: Ondrej Oprala --- text-utils/hexdump-conv.c | 4 ++-- text-utils/hexdump-display.c | 10 +++++----- text-utils/hexdump-parse.c | 12 +++++++----- text-utils/hexdump.c | 4 ++-- text-utils/hexdump.h | 8 ++++---- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/text-utils/hexdump-conv.c b/text-utils/hexdump-conv.c index e17acc4fe..0c4f15fa0 100644 --- a/text-utils/hexdump-conv.c +++ b/text-utils/hexdump-conv.c @@ -38,7 +38,7 @@ #include "xalloc.h" void -conv_c(PR *pr, u_char *p) +conv_c(struct hexdump_pr *pr, u_char *p) { char *buf = NULL; char const *str; @@ -85,7 +85,7 @@ strpr: *pr->cchar = 's'; } void -conv_u(PR *pr, u_char *p) +conv_u(struct hexdump_pr *pr, u_char *p) { static const char *list[] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", diff --git a/text-utils/hexdump-display.c b/text-utils/hexdump-display.c index b6b1f140d..21ae62e56 100644 --- a/text-utils/hexdump-display.c +++ b/text-utils/hexdump-display.c @@ -54,7 +54,7 @@ static off_t address; /* address/offset in stream */ static off_t eaddress; /* end address */ static inline void -print(PR *pr, unsigned char *bp) { +print(struct hexdump_pr *pr, unsigned char *bp) { switch(pr->flags) { case F_ADDRESS: @@ -150,7 +150,7 @@ print(PR *pr, unsigned char *bp) { } } -static void bpad(PR *pr) +static void bpad(struct hexdump_pr *pr) { static const char *spec = " -0+#"; char *p1, *p2; @@ -180,7 +180,7 @@ void display(void) register struct list_head *fs; register FS *fss; register FU *fu; - register PR *pr; + register struct hexdump_pr *pr; register int cnt; register unsigned char *bp; off_t saveaddress; @@ -203,7 +203,7 @@ void display(void) while (cnt) { list_for_each(r, &fu->prlist) { - pr = list_entry(r, PR, prlist); + pr = list_entry(r, struct hexdump_pr, prlist); if (eaddress && address >= eaddress && !(pr->flags&(F_TEXT|F_BPAD))) @@ -238,7 +238,7 @@ void display(void) eaddress = address; } list_for_each (p, &endfu->prlist) { - pr = list_entry(p, PR, prlist); + pr = list_entry(p, struct hexdump_pr, prlist); switch(pr->flags) { case F_ADDRESS: printf(pr->fmt, eaddress); diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c index 31a82e3ca..38c45131b 100644 --- a/text-utils/hexdump-parse.c +++ b/text-utils/hexdump-parse.c @@ -204,7 +204,7 @@ int block_size(FS *fs) void rewrite_rules(FS *fs) { enum { NOTOKAY, USEBCNT, USEPREC } sokay; - PR *pr; + struct hexdump_pr *pr; FU *fu; struct list_head *p, *q; char *p1, *p2, *fmtp; @@ -220,7 +220,7 @@ void rewrite_rules(FS *fs) nconv = 0; fmtp = fu->fmt; while (*fmtp) { - pr = xcalloc(1, sizeof(PR)); + pr = xcalloc(1, sizeof(struct hexdump_pr)); INIT_LIST_HEAD(&pr->prlist); list_add_tail(&pr->prlist, &fu->prlist); @@ -376,7 +376,7 @@ isint: cs[2] = '\0'; } /* - * Copy to PR format string, set conversion character + * Copy to hexdump_pr format string, set conversion character * pointer, update original. */ savech = *p2; @@ -399,7 +399,8 @@ isint: cs[2] = '\0'; */ if (!fu->bcnt) list_for_each(q, &fu->prlist) - fu->bcnt += (list_entry(q, PR, prlist))->bcnt; + fu->bcnt + += (list_entry(q, struct hexdump_pr, prlist))->bcnt; } /* * If the format string interprets any data at all, and it's @@ -419,7 +420,8 @@ isint: cs[2] = '\0'; fu->reps += (blocksize - fs->bcnt) / fu->bcnt; if (fu->reps > 1) { if (!list_empty(&fu->prlist)) { - pr = list_last_entry(&fu->prlist, PR, prlist); + pr = list_last_entry(&fu->prlist, + struct hexdump_pr, prlist); for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) p2 = isspace(*p1) ? p1 : NULL; if (p2) diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c index 6bccc0262..5dfbf1a80 100644 --- a/text-utils/hexdump.c +++ b/text-utils/hexdump.c @@ -208,13 +208,13 @@ void hex_free(void) struct list_head *p, *pn, *q, *qn, *r, *rn; FS *fs; FU *fu; - PR *pr; + struct hexdump_pr *pr; list_for_each_safe(p, pn, &fshead) { fs = list_entry(p, FS, fslist); list_for_each_safe(q, qn, &fs->fulist) { fu = list_entry(q, FU, fulist); list_for_each_safe(r, rn, &fu->prlist) { - pr = list_entry(r, PR, prlist); + pr = list_entry(r, struct hexdump_pr, prlist); free(pr->fmt); free(pr); } diff --git a/text-utils/hexdump.h b/text-utils/hexdump.h index 6b15df72e..6841cf43c 100644 --- a/text-utils/hexdump.h +++ b/text-utils/hexdump.h @@ -35,7 +35,7 @@ #include "c.h" #include "list.h" -typedef struct _pr { +struct hexdump_pr { struct list_head prlist; /* next print unit */ #define F_ADDRESS 0x001 /* print offset */ #define F_BPAD 0x002 /* blank pad */ @@ -53,7 +53,7 @@ typedef struct _pr { char *cchar; /* conversion character */ char *fmt; /* printf format */ char *nospace; /* no whitespace version */ -} PR; +}; typedef struct _fu { struct list_head fulist; /* next format unit */ @@ -88,7 +88,7 @@ void rewrite_rules(FS *); void addfile(char *); void display(void); void __attribute__((__noreturn__)) usage(FILE *out); -void conv_c(PR *, u_char *); -void conv_u(PR *, u_char *); +void conv_c(struct hexdump_pr *, u_char *); +void conv_u(struct hexdump_pr *, u_char *); int next(char **); int parse_args(int, char **); -- cgit v1.2.3-55-g7522