From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24497 invoked by alias); 15 May 2006 12:00:47 -0000 Received: (qmail 24437 invoked by uid 22791); 15 May 2006 12:00:44 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 15 May 2006 12:00:33 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id k4FC0Sl1014119; Mon, 15 May 2006 14:00:28 +0200 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id k4FC0SOt014109; Mon, 15 May 2006 14:00:28 +0200 Date: Mon, 15 May 2006 12:00:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] res_debug.c tweak Message-ID: <20060515120027.GP4651@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00016.txt.bz2 Hi! error array doesn't really need to be writable... 2006-05-15 Jakub Jelinek * res_debug.c (loc_ntoa): Make error const. --- libc/res_debug.c.jj 2006-05-15 13:49:58.000000000 +0200 +++ libc/res_debug.c 2006-05-15 13:52:22.000000000 +0200 @@ -896,7 +896,7 @@ loc_ntoa(binary, ascii) const u_char *binary; char *ascii; { - static char error[] = "?"; + static const char error[] = "?"; static char tmpbuf[sizeof "1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"]; const u_char *cp = binary; @@ -976,11 +976,11 @@ loc_ntoa(binary, ascii) altmeters = (altval / 100) * altsign; if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL) - sizestr = error; + sizestr = (char *) error; if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL) - hpstr = error; + hpstr = (char *) error; if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL) - vpstr = error; + vpstr = (char *) error; sprintf(ascii, "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm", @@ -988,11 +988,11 @@ loc_ntoa(binary, ascii) longdeg, longmin, longsec, longsecfrac, eastwest, altmeters, altfrac, sizestr, hpstr, vpstr); - if (sizestr != error) + if (sizestr != (char *) error) free(sizestr); - if (hpstr != error) + if (hpstr != (char *) error) free(hpstr); - if (vpstr != error) + if (vpstr != (char *) error) free(vpstr); return (ascii); Jakub