From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6E2B71F461 for ; Sun, 8 Sep 2019 17:47:30 +0000 (UTC) Received: from localhost ([::1]:49952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i71Hc-0006rb-Ul for normalperson@yhbt.net; Sun, 08 Sep 2019 13:47:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i71HW-0006rP-4t for bug-gnulib@gnu.org; Sun, 08 Sep 2019 13:47:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i71HU-0002g2-Pl for bug-gnulib@gnu.org; Sun, 08 Sep 2019 13:47:21 -0400 Received: from smtp1.cs.stanford.edu ([171.64.64.25]:39884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i71HU-0002fg-KX for bug-gnulib@gnu.org; Sun, 08 Sep 2019 13:47:20 -0400 Received: from mail-io1-f53.google.com ([209.85.166.53]:32845) by smtp1.cs.Stanford.EDU with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.1) (envelope-from ) id 1i71HR-0000OY-Ea for bug-gnulib@gnu.org; Sun, 08 Sep 2019 10:47:17 -0700 Received: by mail-io1-f53.google.com with SMTP id m11so23724191ioo.0 for ; Sun, 08 Sep 2019 10:47:17 -0700 (PDT) X-Gm-Message-State: APjAAAXO6O+5AjV0j8jY2kYm3A5Adj91pI+8Mv/yTgd38YLJCsS1TKxI 4ih9LR4361blkrksE2+RSzBNC/26VGLq6C6biT0= X-Google-Smtp-Source: APXvYqzzT19sTjkcPaHnxDFQTXzzxoNsTsIPlEdAosKCJwtezVAtNyGZcoKtT38Y8K14mj04UWetW+B2kbDz8fbmz1g= X-Received: by 2002:a02:3f12:: with SMTP id d18mr7727804jaa.39.1567964836925; Sun, 08 Sep 2019 10:47:16 -0700 (PDT) MIME-Version: 1.0 References: <1704385.skmA4EAMxR@omega> <6638d9b2-76f7-f99d-1d65-5e166c9c3791@maxsi.org> <20e8b601-7640-4231-8449-3f3cc7f87c45@cs.ucla.edu> <2427540.ZR1v4N3Qci@omega> In-Reply-To: <2427540.ZR1v4N3Qci@omega> From: Ben Pfaff Date: Sun, 8 Sep 2019 10:47:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: critique of gnulib - string allocation To: Bruno Haible Content-Type: text/plain; charset="UTF-8" X-Scan-Signature: c34b9e52c8715c7e60548704bd659ba6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 171.64.64.25 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonas 'Sortie' Termansen , Paul Eggert , Gnulib bugs Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On Sun, Sep 8, 2019 at 10:08 AM Bruno Haible wrote: > So, what we would need is are functions > > char * substring (const char *string, size_t length); > char * concatenated_string2 (const char *string1, size_t length1, > const char *string2, size_t length2); > char * concatenated_string3 (const char *string1, size_t length1, > const char *string2, size_t length2, > const char *string3, size_t length3); > ... > > where the length arguments are set to SIZE_MAX to designate the entire > string. I think that substring() is the same as xstrndup().