From owner-cvs-all Wed Feb 14 7: 4:39 2001 Delivered-To: cvs-all@freebsd.org Received: from columbus.cris.net (ns.cris.net [212.110.128.65]) by hub.freebsd.org (Postfix) with ESMTP id 3AF0137B4EC; Wed, 14 Feb 2001 07:04:24 -0800 (PST) Received: from spider (dyn-206.criscom.net [212.110.143.206]) by columbus.cris.net (8.9.3/8.9.3) with SMTP id RAA70933; Wed, 14 Feb 2001 17:02:41 +0200 (EET) Message-ID: <000e01c09686$8b6e0040$ce8f6ed4@spider.cris.net> From: "Alexey Zelkin" To: "Andrey A. Chernov" Cc: , Subject: Re: cvs commit: src/lib/libc/locale ldpart.c ldpart.h Date: Wed, 14 Feb 2001 16:02:53 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG hi, >> > phantom 2001/02/13 07:29:39 PST >> > >> > Modified files: >> > lib/libc/locale ldpart.c ldpart.h >> > Log: >> > add additional function parameter: bufsize_min. it's possible >> > to check two sizes per one function invocation now. >> >> Why only two hardcoded? It prevents additional locale extensions - there >> must be unlimited number of possible extensions. It means that ldpart must >> just return line count, and upper level code must decide which level of >> extensions used and what actions are needed to compensate missing >> parts for each returned line count. > >In "C" terms I mean something like: > > ret = load_part(... &line_count, ..., &using_that_locale, ...) > > if (ret == 0 && using_that_locale) { > if (line_count < EXT1) { /* min */ > compensate_ext1; > } > if (line_count < EXT2) { /* EXT2 > EXT1 */ > compensate_ext2; > } > ... EXT3, etc. ... /* EXT3 > EXT2, etc. */ > } It's not such simple as you propose. First of all, num_lines check should be located before code which fills internal structures (i.e. before set_from_buf() call). It means that we need to make function which should check num_lines and return TRUE/FALSE for correct/incorrect amount of numbers and pass pointer to this function in __part_load_locale() or split out set_from_buf() call from ldpart.c and implement same code after each __part_load_locale() call. IMHO, both variants are just overheads and includes a lot of unneeded code to libc. I think we don't need such changes until we really need them. BTW, I don't propose to add __part_load_locale() calls to libc anymore because it's already used in all places there I proposed to use it. Also __part_load_locale() is libc internal function and will not be used in any external programs. Logicaly next step is optimization and not universalization, isn't it ? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message