From owner-svn-src-stable@freebsd.org Sun Mar 12 05:35:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB15ACF9134; Sun, 12 Mar 2017 05:35:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BB6D1E5D; Sun, 12 Mar 2017 05:35:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2C5ZSjN071496; Sun, 12 Mar 2017 05:35:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2C5ZSYE071493; Sun, 12 Mar 2017 05:35:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201703120535.v2C5ZSYE071493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 12 Mar 2017 05:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315134 - stable/11/usr.bin/dc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 05:35:29 -0000 Author: pfg Date: Sun Mar 12 05:35:28 2017 New Revision: 315134 URL: https://svnweb.freebsd.org/changeset/base/315134 Log: MFC r314321: dc(1): Merge minor changes from OpenBSD. Prefer setvbuf() to setlinebuf() for portability. Some style(9) and redundant tests for NULL. These are only meant to ease up merging newer changes. Obtained from: OpenBSD Modified: stable/11/usr.bin/dc/bcode.c stable/11/usr.bin/dc/dc.c stable/11/usr.bin/dc/stack.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dc/bcode.c ============================================================================== --- stable/11/usr.bin/dc/bcode.c Sun Mar 12 05:20:49 2017 (r315133) +++ stable/11/usr.bin/dc/bcode.c Sun Mar 12 05:35:28 2017 (r315134) @@ -960,9 +960,8 @@ badd(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -987,9 +986,8 @@ bsub(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1035,9 +1033,8 @@ bmul(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1060,9 +1057,8 @@ bdiv(void) u_int scale; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1097,9 +1093,8 @@ bmod(void) u_int scale; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1134,9 +1129,8 @@ bdivmod(void) u_int scale; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1176,9 +1170,8 @@ bexp(void) u_int rscale; p = pop_number(); - if (p == NULL) { + if (p == NULL) return; - } a = pop_number(); if (a == NULL) { push_number(p); @@ -1299,9 +1292,8 @@ bsqrt(void) onecount = 0; n = pop_number(); - if (n == NULL) { + if (n == NULL) return; - } if (BN_is_zero(n->number)) { r = new_number(); push_number(r); @@ -1342,9 +1334,8 @@ not(void) struct number *a; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } a->scale = 0; bn_check(BN_set_word(a->number, BN_get_word(a->number) ? 0 : 1)); push_number(a); @@ -1363,9 +1354,8 @@ equal_numbers(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1383,9 +1373,8 @@ less_numbers(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1403,9 +1392,8 @@ lesseq_numbers(void) struct number *a, *b, *r; a = pop_number(); - if (a == NULL) { + if (a == NULL) return; - } b = pop_number(); if (b == NULL) { push_number(a); @@ -1736,9 +1724,8 @@ eval_tos(void) char *p; p = pop_string(); - if (p == NULL) - return; - eval_string(p); + if (p != NULL) + eval_string(p); } void Modified: stable/11/usr.bin/dc/dc.c ============================================================================== --- stable/11/usr.bin/dc/dc.c Sun Mar 12 05:20:49 2017 (r315133) +++ stable/11/usr.bin/dc/dc.c Sun Mar 12 05:35:28 2017 (r315134) @@ -120,8 +120,8 @@ main(int argc, char *argv[]) if (!preproc_done) init_bmachine(extended_regs); - setlinebuf(stdout); - setlinebuf(stderr); + (void)setvbuf(stdout, NULL, _IOLBF, 0); + (void)setvbuf(stderr, NULL, _IOLBF, 0); if (argc > 1) usage(); Modified: stable/11/usr.bin/dc/stack.c ============================================================================== --- stable/11/usr.bin/dc/stack.c Sun Mar 12 05:20:49 2017 (r315133) +++ stable/11/usr.bin/dc/stack.c Sun Mar 12 05:35:28 2017 (r315134) @@ -68,10 +68,8 @@ stack_free_value(struct value *v) free(v->u.string); break; } - if (v->array != NULL) { - array_free(v->array); - v->array = NULL; - } + array_free(v->array); + v->array = NULL; } /* Copy number or string content into already allocated target */ @@ -225,10 +223,8 @@ stack_popnumber(struct stack *stack) if (stack_empty(stack)) return (NULL); - if (stack->stack[stack->sp].array != NULL) { - array_free(stack->stack[stack->sp].array); - stack->stack[stack->sp].array = NULL; - } + array_free(stack->stack[stack->sp].array); + stack->stack[stack->sp].array = NULL; if (stack->stack[stack->sp].type != BCODE_NUMBER) { warnx("not a number"); /* XXX remove */ return (NULL); @@ -242,10 +238,8 @@ stack_popstring(struct stack *stack) if (stack_empty(stack)) return (NULL); - if (stack->stack[stack->sp].array != NULL) { - array_free(stack->stack[stack->sp].array); - stack->stack[stack->sp].array = NULL; - } + array_free(stack->stack[stack->sp].array); + stack->stack[stack->sp].array = NULL; if (stack->stack[stack->sp].type != BCODE_STRING) { warnx("not a string"); /* XXX remove */ return (NULL); @@ -257,9 +251,8 @@ void stack_clear(struct stack *stack) { - while (stack->sp >= 0) { + while (stack->sp >= 0) stack_free_value(&stack->stack[stack->sp--]); - } free(stack->stack); stack_init(stack); }