]> git.pond.sub.org Git - empserver/commitdiff
Remove useless multiplications with sizeof(char) and sizeof(s_char).
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 26 Mar 2006 10:16:08 +0000 (10:16 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 26 Mar 2006 10:16:08 +0000 (10:16 +0000)
Replace by literal 1 in other contexts.

src/client/termio.c
src/lib/commands/navi.c
src/lib/commands/path.c
src/lib/commands/rea.c
src/lib/commands/rout.c
src/lib/commands/sect.c
src/lib/commands/surv.c
src/lib/common/maps.c
src/lib/subs/radmap.c
src/lib/subs/satmap.c
src/lib/update/anno.c

index 8025406d090eb18e29a7f5cb5175b29db415a54d..a75b080d55030c8ce35ae40bc17fb8f661c412c1 100644 (file)
@@ -164,7 +164,7 @@ termio(int fd, int sock, FILE *auxfi)
        if (*p == '\n') {
            if (tagging) {
                tag = malloc(sizeof(struct tagstruct));
-               tag->item = malloc((1 + p - s) * sizeof(char));
+               tag->item = malloc(1 + p - s);
                tag->next = taglist;
                taglist = tag;
                t = tag->item;
index 56a9079a6b5f6f3d6fbfa1e714a1d79f1a6d04bd..154efaab411ff3c5b3f15b480ffabee67ceb0133 100644 (file)
@@ -236,7 +236,7 @@ nav_map(int x, int y, int show_designations)
     if (!snxtsct(&ns, what))
        return RET_FAIL;
     if (!wmapbuf)
-       wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       wmapbuf = malloc(WORLD_Y * MAPWIDTH(1));
     if (!wmap) {
        wmap = malloc(WORLD_Y * sizeof(s_char *));
        if (wmap && wmapbuf) {
index 12ca7756613cdda555fc70536a4eac6768ffbf12..8ecea9d8aba4b9adbf672386147989cb017f723f 100644 (file)
@@ -82,7 +82,7 @@ path(void)
        return RET_FAIL;
     }
     if (!mapbuf)
-       mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
+       mapbuf = malloc(WORLD_Y * MAPWIDTH(3));
     if (!map) {
        map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
index f604e606be77a316c9e08074c4b9ec5a3bdefbb1..8dcb61b81ffe64edd6e34591aee0bfa3b59d594b 100644 (file)
@@ -168,7 +168,7 @@ rea(void)
            nbytes = tgm.tel_length;
            if (nbytes > sizeof(msgbuf) - 1)
                nbytes = sizeof(msgbuf) - 1;
-           (void)fread(msgbuf, sizeof(s_char), nbytes, telfp);
+           fread(msgbuf, 1, nbytes, telfp);
            msgbuf[nbytes] = 0;
            if (readit)
                uprnf(msgbuf);
index 4db03efb30cc01c5d452414da67ec1115d26127f..3d90667731ed8149054fbb4b55397e9a1844644e 100644 (file)
@@ -90,7 +90,7 @@ rout(void)
     } else if (!snxtsct(&ns, str))
        return RET_FAIL;
     if (!mapbuf)
-       mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
+       mapbuf = malloc(WORLD_Y * MAPWIDTH(3));
     if (!map) {
        map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
@@ -102,7 +102,7 @@ rout(void)
        }
     }
     if (!buf)
-       buf = malloc((MAPWIDTH(3) + 12) * sizeof(s_char));
+       buf = malloc(MAPWIDTH(3) + 12);
     if (!mapbuf || !map || !buf) {
        pr("Memory error, tell the deity.\n");
        logerror("malloc failed in rout\n");
index 4058d43b422c5bb9733e1ecb16629cdb94382204..7cb7c53b69da3d3fe83a86abc986bbc351fe7b64 100644 (file)
@@ -82,7 +82,7 @@ sct(void)
     } else if (!snxtsct(&ns, str))
        return RET_SYN;
     if (!mapbuf)
-       mapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
     if (!map) {
        map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
index 214c86e6aaf50cdf9f3c4385aa91f7b2c47d3287..d3f5ee5fbcf355b0ce5ec230302076cf75592061 100644 (file)
@@ -101,7 +101,7 @@ surv(void)
     } else if (!snxtsct(&nstr, str))
        return RET_SYN;
     if (!mapbuf)
-       mapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       mapbuf = malloc(WORLD_Y * MAPWIDTH(1));
     if (!map) {
        map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
index 558b6b161d75a5bf3f030957d9a43eb7c3e72751..f3655e86e6452c618a1a1448372f0786825800f9 100644 (file)
@@ -71,7 +71,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp)
     static s_char **wmap = NULL;
 
     if (!wmapbuf)
-       wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       wmapbuf = malloc(WORLD_Y * MAPWIDTH(1));
     if (!wmap) {
        wmap = malloc(WORLD_Y * sizeof(s_char *));
        if (wmap && wmapbuf) {
index 4af2ba17f7e29b7f86bb9ea4bd9a9232c5981c91..d22fba40b1b77d42b2a2dcdcc50f50bc36e66a0a 100644 (file)
@@ -89,11 +89,9 @@ radmap2(int owner,
     int changed = 0;
 
     if (!radbuf)
-       radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
-                                 sizeof(s_char));
+       radbuf = malloc(WORLD_Y * (WORLD_X + 1));
     if (!visbuf)
-       visbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
-                                 sizeof(s_char));
+       visbuf = malloc(WORLD_Y * (WORLD_X + 1));
     if (!rad) {
        rad = malloc(WORLD_Y * sizeof(s_char *));
        if (rad && radbuf) {
index 316a1468d3119bfae30237fa9850bc9f80fffe52..14495b835fd7e46e7f66e8ecaa00ddefb56d2533 100644 (file)
@@ -71,8 +71,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
        return;
 
     if (!radbuf)
-       radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
-                                 sizeof(s_char));
+       radbuf = malloc(WORLD_Y * (WORLD_X + 1));
     if (!rad) {
        rad = malloc(WORLD_Y * sizeof(s_char *));
        if (rad && radbuf) {
index a9244fdca610eea3d0a1ec3c4c4de498a3250e49..806fdf286de60a14e73dcb750c16eca61518b125 100644 (file)
@@ -147,14 +147,14 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename,
            ++saved;
        } else
            ++deleted;
-       if (fread(message, sizeof(char), tgm.tel_length, annfp) !=
+       if (fread(message, 1, tgm.tel_length, annfp) !=
            (size_t)tgm.tel_length) {
            logerror("error reading body from telegram file %s",
                     annfil);
            return 0;
        }
        if (writeit) {
-           if (fwrite(message, sizeof(char), tgm.tel_length, tmpfp) !=
+           if (fwrite(message, 1, tgm.tel_length, tmpfp) !=
                (size_t)tgm.tel_length) {
                logerror("error writing body to temporary telegram "
                         "file %s", tmp_filename);