Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 29 Aug 2002 11:35:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 29 Aug 2002 11:35:38 -0400 Received: from pD9E2399E.dip.t-dialin.net ([217.226.57.158]:49095 "EHLO hawkeye.luckynet.adm") by vger.kernel.org with ESMTP id ; Thu, 29 Aug 2002 11:35:38 -0400 Date: Thu, 29 Aug 2002 09:39:14 -0600 (MDT) From: Thunder from the hill X-X-Sender: thunder@hawkeye.luckynet.adm To: Rusty Russell cc: junio@siamese.dyndns.org, Linux Kernel Mailing List Subject: Re: [TRIVIAL] strlen("literal string") -> (sizeof("literal string")-1) In-Reply-To: <20020828221716.1A73C2C09E@lists.samba.org> Message-ID: X-Location: Dorndorf/Steudnitz; Germany MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 891 Lines: 25 Hi, On Thu, 29 Aug 2002, Rusty Russell wrote: > If you really care about that, try: > > /* Be paranoid in case someone uses strlen(&("FOO"[0])) */ > #define strlen(x) \ > (__builtin_constant_p(x) && sizeof(x) != sizeof(char *) > ? (sizeof(x) - 1) : __strlen(x)) I must say that doesn't make the code any cleaner, which leads to it being not as clean as Keith suggested. It was a code cleanup, not a code messup. Thunder -- --./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .- --/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..- .- -/---/--/---/.-./.-./---/.--/.-.-.- --./.-/-.../.-./.././.-../.-.-.- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/