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/f907f0e74806
branches:  trunk
changeset: 1008602:f907f0e74806
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 df7262ef09c2 -r f907f0e74806 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