From patchwork Sat Nov 6 09:26:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 70323 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 691C5B70EA for ; Sat, 6 Nov 2010 20:26:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755069Ab0KFJ0c (ORCPT ); Sat, 6 Nov 2010 05:26:32 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:58845 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754337Ab0KFJ0b (ORCPT ); Sat, 6 Nov 2010 05:26:31 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id F22D71C158DD; Sat, 6 Nov 2010 10:26:29 +0100 (CET) Received: from igel.home (ppp-93-104-133-180.dynamic.mnet-online.de [93.104.133.180]) by mail.mnet-online.de (Postfix) with ESMTP id AF50D1C00157; Sat, 6 Nov 2010 10:26:29 +0100 (CET) Received: by igel.home (Postfix, from userid 501) id 67C17CA2A0; Sat, 6 Nov 2010 10:26:29 +0100 (CET) From: Andreas Schwab To: Stephen Hemminger Subject: [PATCH] iproute2: remove useless use of buffer CC: netdev@vger.kernel.org X-Yow: Pardon me, but do you know what it means to be TRULY ONE with your BOOTH! Date: Sat, 06 Nov 2010 10:26:29 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Print directly to the file instead of going through a buffer. Signed-off-by: Andreas Schwab --- ip/ipaddress.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 19b3d6e..fc306e6 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -613,23 +613,21 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, fprintf(fp, "%s", (char*)RTA_DATA(rta_tb[IFA_LABEL])); if (rta_tb[IFA_CACHEINFO]) { struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]); - char buf[128]; fprintf(fp, "%s", _SL_); + fprintf(fp, " valid_lft "); if (ci->ifa_valid == INFINITY_LIFE_TIME) - sprintf(buf, "valid_lft forever"); + fprintf(fp, "forever"); else - sprintf(buf, "valid_lft %usec", ci->ifa_valid); + fprintf(fp, "%usec", ci->ifa_valid); + fprintf(fp, " preferred_lft "); if (ci->ifa_prefered == INFINITY_LIFE_TIME) - sprintf(buf+strlen(buf), " preferred_lft forever"); + fprintf(fp, "forever"); else { if (deprecated) - sprintf(buf+strlen(buf), " preferred_lft %dsec", - ci->ifa_prefered); + fprintf(fp, "%dsec", ci->ifa_prefered); else - sprintf(buf+strlen(buf), " preferred_lft %usec", - ci->ifa_prefered); + fprintf(fp, "%usec", ci->ifa_prefered); } - fprintf(fp, " %s", buf); } fprintf(fp, "\n"); fflush(fp);