Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tic tic: promote record type when merging newer into...



details:   https://anonhg.NetBSD.org/src/rev/cdf91da1992d
branches:  trunk
changeset: 970567:cdf91da1992d
user:      roy <roy%NetBSD.org@localhost>
date:      Sat Mar 28 15:19:56 2020 +0000

description:
tic: promote record type when merging newer into older

diffstat:

 usr.bin/tic/tic.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 938006e7f70a -r cdf91da1992d usr.bin/tic/tic.c
--- a/usr.bin/tic/tic.c Sat Mar 28 13:15:24 2020 +0000
+++ b/usr.bin/tic/tic.c Sat Mar 28 15:19:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $ */
+/* $NetBSD: tic.c,v 1.35 2020/03/28 15:19:56 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $");
+__RCSID("$NetBSD: tic.c,v 1.35 2020/03/28 15:19:56 roy Exp $");
 
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -228,6 +228,22 @@
        int num;
        size_t n;
 
+       /* Promote record type if needed. */
+       if (rtic->rtype < utic->rtype) {
+               cap = rtic->nums.buf;
+               rtic->nums.buf = NULL;
+               rtic->nums.buflen = rtic->nums.bufpos = 0;
+               for (n = rtic->nums.entries; n > 0; n--) {
+                       ind = _ti_decode_16(&cap);
+                       num = _ti_decode_num(&cap, rtic->rtype);
+                       if (VALID_NUMERIC(num) &&
+                           !_ti_encode_buf_id_num(&rtic->nums, ind, num,
+                           _ti_numsize(utic)))
+                               err(1, "encode num");
+               }
+               rtic->rtype = utic->rtype;
+       }
+
        cap = utic->flags.buf;
        for (n = utic->flags.entries; n > 0; n--) {
                ind = _ti_decode_16(&cap);



Home | Main Index | Thread Index | Old Index