From patchwork Thu Nov 1 16:02:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Shankar X-Patchwork-Id: 991982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96897-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lostca.se Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="lOWRv4ha"; dkim=pass (1024-bit key; unprotected) header.d=lostca.se header.i=@lostca.se header.b="zmDJ09Kf"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42m9325C8vz9sf9 for ; Fri, 2 Nov 2018 03:02:54 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=tU+Se0tSuhK5OfyUyh8TSAYTdaO3I FzXZAPjSXKsuR5moxu6aJlhJEQlY3SA/pSn8O0JLHy/K7dou+hH5yBdDlTXhw7fi jlw5KASGRvUnseMjPbcmi9HktqBdce+NNE63F/PIysAWOz+8sgqqt+R2hamhp2cw 8HyPhmDCfZVE/o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=H91SCza9543WMNt11qtlngIy8m8=; b=lOW Rv4haW9lYKbYxuJTLUVWmHS0wEaL0Hz6vlOpnNNFGr891v+B09XjfT94p8jvA6Is k6haSdggguUZfWAigDsmr5pa71vK9ljNQb8uo0bjBoE7qZLuf7lmWjcT6/u04+rO qJj7QaFkrejxoEUZRhtSIpTaf/Q7po6c8e1VcxT0= Received: (qmail 128888 invoked by alias); 1 Nov 2018 16:02:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 128801 invoked by uid 89); 1 Nov 2018 16:02:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aloka.lostca.se DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lostca.se; h=date:from:to :subject:message-id:mime-version:content-type; s=howrah; bh=H91S Cza9543WMNt11qtlngIy8m8=; b=zmDJ09Kf6A6ttHAMEdua89mBysDblmfDSaC2 Dt0Da6g3wEc1y+oajK5cUPHlMZHxG51BYGdl+1CLXvKmpPbi4hlUHtyQWS0GYdUH OnsbgckJpYPhcQzLYXiw5dzNQ79HSki981NVrtRRmumytJ258ufgXwrdBy5LTg2s 0ovhEV4= Date: Thu, 1 Nov 2018 16:02:35 +0000 From: Arjun Shankar To: libc-alpha@sourceware.org Subject: [PATCH] Unconditionally call __gconv_get_path when reading iconv configuration Message-ID: <20181101160235.GA90664@aloka.lostca.se> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) __gconv_read_conf is only ever called once during the program's lifetime. This means that __gconv_path_elem is always uninitialized when the function begins executing. __gconv_get_path has an assert to ensure that this expected runtime behaviour is always exhibited. Given this, checking for a NULL value before calling __gconv_get_path is unnecessary. This commit drops the condition and calls __gconv_get_path unconditionally. ChangeLog: 2018-11-01 Arjun Shankar * iconv/gconv_conf.c (__gconv_read_conf): Remove NULL check for __gconv_path_elem and call __gconv_get_path unconditionally. Tested on x86_64. diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index 78010491e6..2b73dd8f45 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -552,8 +552,7 @@ __gconv_read_conf (void) #ifndef STATIC_GCONV /* Find out where we have to look. */ - if (__gconv_path_elem == NULL) - __gconv_get_path (); + __gconv_get_path (); for (cnt = 0; __gconv_path_elem[cnt].name != NULL; ++cnt) {