]> git.pond.sub.org Git - empserver/commitdiff
news: Raise the limit for "number of times" from 127 to 65535
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 27 Jun 2016 19:34:42 +0000 (21:34 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:17 +0000 (20:09 +0200)
News reporting merges news items into recent items with same contents,
until their count reaches 127.  Raise that limit to 65535, by making
struct nwsstr member nws_ntm unsigned short.  Size of struct nwsstr
stays the same on all common machines.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/news.h
src/lib/common/nsc.c
src/lib/subs/nreport.c

index 46c76e9a7e502908169156ae474e0ea33fd65a6c..9e8416a2409032efcae636ca0838652acb29e273 100644 (file)
@@ -30,6 +30,7 @@
  *     Dave Pare
  *     Thomas Ruschak
  *     Steve McClure
+ *     Markus Armbruster, 2004-2016
  */
 
 /*
@@ -47,7 +48,7 @@ struct nwsstr {
     natid nws_ano;             /* "actor" country # */
     unsigned char nws_vrb;     /* action (verb) */
     natid nws_vno;             /* "victim" country # */
-    signed char nws_ntm;       /* number of times */
+    unsigned short nws_ntm;    /* number of times */
     short nws_duration;                /* last time at nws_when + nws_duration */
     time_t nws_when;           /* time of action */
 };
index 4f8662b9d7d3627e2578c68ebf902bf7a096a15f..507a86849bacda450e7e57af0d1c09f848112f62 100644 (file)
@@ -499,7 +499,7 @@ struct castr news_ca[] = {
     {"action", fldoff(nws_vrb), NSC_UCHAR, 0, NULL, EF_NEWS_CHR, 0,
      CA_DUMP},
     {"victim", fldoff(nws_vno), NSC_NATID, 0, NULL, EF_NATION, 0, CA_DUMP},
-    {"times", fldoff(nws_ntm), NSC_CHAR, 0, NULL, EF_BAD, 0, CA_DUMP},
+    {"times", fldoff(nws_ntm), NSC_USHORT, 0, NULL, EF_BAD, 0, CA_DUMP},
     {"duration", fldoff(nws_duration), NSC_SHORT, 0, NULL, EF_BAD, 0,
      CA_DUMP},
     {"time", fldoff(nws_when), NSC_TIME, 0, NULL, EF_BAD, 0, CA_DUMP},
index 310ae705e8dd64059d05f996ad19bf3d4d3bde18..1df7cbde24a4eff4be2862341f7ef43089bad944 100644 (file)
@@ -30,7 +30,7 @@
  *     Dave Pare, 1994
  *     Steve McClure, 1997
  *     Ron Koenderink, 2005
- *     Markus Armbruster, 2004-2012
+ *     Markus Armbruster, 2004-2016
  */
 
 #include <config.h>
@@ -169,7 +169,7 @@ ncache(int actor, int event, int victim, int times)
        if (dur > minutes(5))
            continue;
        if (np->news.nws_vrb == event && np->news.nws_vno == victim &&
-           np->news.nws_ntm + times <= 127) {
+           np->news.nws_ntm + times <= 65535) {
            np->news.nws_ntm += times;
            np->news.nws_duration = dur;
            return np;