From owner-freebsd-arch@FreeBSD.ORG Mon May 29 09:23:46 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5566C16A59A for ; Mon, 29 May 2006 09:23:46 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E16D43D48 for ; Mon, 29 May 2006 09:23:42 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id k4T9NbSM099669 for ; Mon, 29 May 2006 13:23:38 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id k4T9Na1m099666 for freebsd-arch@freebsd.org; Mon, 29 May 2006 13:23:36 +0400 (MSD) (envelope-from yar) Date: Mon, 29 May 2006 13:23:36 +0400 From: Yar Tikhiy To: freebsd-arch@freebsd.org Message-ID: <20060529092335.GD98288@comp.chem.msu.su> References: <20060528164328.GA84031@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060528164328.GA84031@comp.chem.msu.su> User-Agent: Mutt/1.5.9i Subject: Re: Can fts_open() be constified further? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 May 2006 09:23:55 -0000 On Sun, May 28, 2006 at 08:43:28PM +0400, Yar Tikhiy wrote: > Hi folks, > > Currently, fts_open() is declared as follows: > > FTS * > fts_open(char * const *path_argv, int options, > int (*compar)(const FTSENT * const *, const FTSENT * const *)); > > This means that one cannot pass pointers to constant strings in > path_argv[] without getting rather justified warnings from cc. > AFAIK, fts(3) functions aren't supposed to modify the path strings. > Hence the prototype asks to be changed slightly: > > fts_open(const char * const *path_argv, int options, > ^^^^^ > This shouldn't break fts consumers because a pointer to a variable > can be converted to a pointer to a constant w/o warnings (but not > the other way around.) Can anybody see other possible side effects > from such change? I was pointed out in a private mail that the types "const FOO **" and "FOO **" were incompatible, which would break passing "argv" from main() to fts_open(). -- Yar