]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: rename next{fs,fu,pr} to {fs,fu,pr}list
authorOndrej Oprala <ooprala@redhat.com>
Mon, 23 Sep 2013 13:39:20 +0000 (15:39 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 8 Nov 2013 11:54:52 +0000 (12:54 +0100)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
text-utils/display.c
text-utils/hexdump.c
text-utils/hexdump.h
text-utils/parse.c

index b2ed9753fa8041b9c14ba792a7d42fbbc686a161..79a68bf8ff3eed8424b45fe6aea014c7995c760b 100644 (file)
@@ -190,15 +190,15 @@ void display(void)
        while ((bp = get()) != NULL) {
                fs = &fshead; savebp = bp; saveaddress = address;
                list_for_each(p, fs) {
-                       fss = list_entry(p, FS, nextfs);
-                       list_for_each(q, &fss->nextfu) {
-                               fu = list_entry(q, FU, nextfu);
+                       fss = list_entry(p, FS, fslist);
+                       list_for_each(q, &fss->fulist) {
+                               fu = list_entry(q, FU, fulist);
                                if (fu->flags&F_IGNORE)
                                        break;
                                cnt = fu->reps;
                                while (cnt) {
-                                       list_for_each(r, &fu->nextpr) {
-                                               pr = list_entry(r, PR, nextpr);
+                                       list_for_each(r, &fu->prlist) {
+                                               pr = list_entry(r, PR, prlist);
                                            if (eaddress && address >= eaddress &&
                                                !(pr->flags&(F_TEXT|F_BPAD)))
                                                    bpad(pr);
@@ -228,8 +228,8 @@ void display(void)
                                return;
                        eaddress = address;
                }
-               list_for_each (p, &endfu->nextpr) {
-                       pr = list_entry(p, PR, nextpr);
+               list_for_each (p, &endfu->prlist) {
+                       pr = list_entry(p, PR, prlist);
                        switch(pr->flags) {
                        case F_ADDRESS:
                                printf(pr->fmt, (int64_t)eaddress);
index e3c3897ed92f2bd8ea1d2596864bea2ef6fcb492..d5b9992e0d422f08668073c1c912ba2c6db1c1e4 100644 (file)
@@ -72,14 +72,14 @@ int main(int argc, char **argv)
        /* figure out the data block size */
        blocksize = 0;
        list_for_each(p, &fshead) {
-               tfs = list_entry(p, FS, nextfs);
+               tfs = list_entry(p, FS, fslist);
                if ((tfs->bcnt = block_size(tfs)) > blocksize)
                        blocksize = tfs->bcnt;
        }
 
        /* rewrite the rules, do syntax checking */
        list_for_each(p, &fshead)
-               rewrite(list_entry(p, FS, nextfs));
+               rewrite(list_entry(p, FS, fslist));
 
        next(argv);
        display();
index c9fc4a009ef4294cadc2d9a04c24bec9b00ca18a..f81b3bd13b8a508b883b1aaf4d823767035b1c98 100644 (file)
@@ -36,7 +36,7 @@
 #include "list.h"
 
 typedef struct _pr {
-       struct list_head nextpr;                /* next print unit */
+       struct list_head prlist;                /* next print unit */
 #define        F_ADDRESS       0x001           /* print offset */
 #define        F_BPAD          0x002           /* blank pad */
 #define        F_C             0x004           /* %_c */
@@ -56,8 +56,8 @@ typedef struct _pr {
 } PR;
 
 typedef struct _fu {
-       struct list_head nextfu;                /* next format unit */
-       struct list_head nextpr;                /* next print unit */
+       struct list_head fulist;                /* next format unit */
+       struct list_head prlist;                /* next print unit */
 #define        F_IGNORE        0x01            /* %_A */
 #define        F_SETREP        0x02            /* rep count set, not default */
        unsigned int flags;             /* flag values */
@@ -67,8 +67,8 @@ typedef struct _fu {
 } FU;
 
 typedef struct _fs {                   /* format strings */
-       struct list_head nextfs;                /* linked list of format strings */
-       struct list_head nextfu;                /* linked list of format units */
+       struct list_head fslist;                /* linked list of format strings */
+       struct list_head fulist;                /* linked list of format units */
        int bcnt;
 } FS;
 
index a6e5778252d025989e96142d02662ea09f999947..08e6123e5fbc34aa34f2bb14b6f73e236f332c01 100644 (file)
@@ -87,9 +87,9 @@ void add(const char *fmt)
 
        /* Start new linked list of format units. */
        tfs = xcalloc(1, sizeof(FS));
-       INIT_LIST_HEAD(&tfs->nextfs);
-       INIT_LIST_HEAD(&tfs->nextfu);
-       list_add_tail(&tfs->nextfs, &fshead);
+       INIT_LIST_HEAD(&tfs->fslist);
+       INIT_LIST_HEAD(&tfs->fulist);
+       list_add_tail(&tfs->fslist, &fshead);
 
        /* Take the format string and break it up into format units. */
        p = (unsigned char *)fmt;
@@ -102,9 +102,9 @@ void add(const char *fmt)
 
                /* Allocate a new format unit and link it in. */
                tfu = xcalloc(1, sizeof(FU));
-               INIT_LIST_HEAD(&tfu->nextfu);
-               INIT_LIST_HEAD(&tfu->nextpr);
-               list_add_tail(&tfu->nextfu, &tfs->nextfu);
+               INIT_LIST_HEAD(&tfu->fulist);
+               INIT_LIST_HEAD(&tfu->prlist);
+               list_add_tail(&tfu->fulist, &tfs->fulist);
                tfu->reps = 1;
 
                /* If leading digit, repetition count. */
@@ -166,8 +166,8 @@ int block_size(FS *fs)
        int prec;
 
        /* figure out the data block size needed for each format unit */
-       list_for_each (p, &fs->nextfu) {
-               fu = list_entry(p, FU, nextfu);
+       list_for_each (p, &fs->fulist) {
+               fu = list_entry(p, FU, fulist);
                if (fu->bcnt) {
                        cursize += fu->bcnt * fu->reps;
                        continue;
@@ -229,8 +229,8 @@ void rewrite(FS *fs)
 
        prec = 0;
 
-       list_for_each (p, &fs->nextfu) {
-               fu = list_entry(p, FU, nextfu);
+       list_for_each (p, &fs->fulist) {
+               fu = list_entry(p, FU, fulist);
                /*
                 * Break each format unit into print units; each
                 * conversion character gets its own.
@@ -239,8 +239,8 @@ void rewrite(FS *fs)
                fmtp = fu->fmt;
                while (*fmtp) {
                        pr = xcalloc(1, sizeof(PR));
-                       INIT_LIST_HEAD(&pr->nextpr);
-                       list_add_tail(&pr->nextpr, &fu->nextpr);
+                       INIT_LIST_HEAD(&pr->prlist);
+                       list_add_tail(&pr->prlist, &fu->prlist);
 
                        /* Skip preceding text and up to the next % sign. */
                        p1 = fmtp;
@@ -434,8 +434,8 @@ void rewrite(FS *fs)
                 * so can adjust rep count later.
                 */
                if (!fu->bcnt)
-                       list_for_each(q, &fu->nextpr)
-                               fu->bcnt += (list_entry(q, PR, nextpr))->bcnt;
+                       list_for_each(q, &fu->prlist)
+                               fu->bcnt += (list_entry(q, PR, prlist))->bcnt;
        }
        /*
         * If the format string interprets any data at all, and it's
@@ -446,14 +446,14 @@ void rewrite(FS *fs)
         * If rep count is greater than 1, no trailing whitespace
         * gets output from the last iteration of the format unit.
         */
-       list_for_each (p, &fs->nextfu) {
-               fu = list_entry(p, FU, nextfu);
-               if (list_entry_is_last(&fu->nextfu, &fs->nextfu) && fs->bcnt < blocksize &&
+       list_for_each (p, &fs->fulist) {
+               fu = list_entry(p, FU, fulist);
+               if (list_entry_is_last(&fu->fulist, &fs->fulist) && fs->bcnt < blocksize &&
                    !(fu->flags&F_SETREP) && fu->bcnt)
                        fu->reps += (blocksize - fs->bcnt) / fu->bcnt;
                if (fu->reps > 1) {
-                       if (!list_empty(&fu->nextpr)) {
-                               pr = list_last_entry(&fu->nextpr, PR, nextpr);
+                       if (!list_empty(&fu->prlist)) {
+                               pr = list_last_entry(&fu->prlist, PR, prlist);
                                for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
                                        p2 = isspace(*p1) ? p1 : NULL;
                                if (p2)