From patchwork Mon Feb 1 10:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 41881 X-Patchwork-Delegate: arjun.is@lostca.se Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 423183842402; Mon, 1 Feb 2021 10:08:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 423183842402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612174102; bh=vce9XERZ5pWTS+SF8AwljELRM8ho0mstgw0L9HE/+FM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RBICaDTTDukhYtFG9PYtsewvUkrhCgIvhvWPys62a1Rl1tEtTpL7bNSXHUl57g4Si kkvm7n97jmXyy8mNxsaHFux4vQXdzTj0m5Pz/IxhcwH/msK/UZdjLmwe2Hfs4/1D9T JSwPX4ejU2lwEu5YWPNsMZxNvSQfeNyz9jJuw26U= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 979DA385141F for ; Mon, 1 Feb 2021 10:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 979DA385141F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-568-F1GRUpKWOvyWBoXALDt0ow-1; Mon, 01 Feb 2021 05:08:07 -0500 X-MC-Unique: F1GRUpKWOvyWBoXALDt0ow-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 499C91005E40 for ; Mon, 1 Feb 2021 10:08:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-35.ams2.redhat.com [10.36.113.35]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72B1D5D9DC for ; Mon, 1 Feb 2021 10:08:05 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] manual: Correct description of ENTRY [BZ #17183] Date: Mon, 01 Feb 2021 11:08:03 +0100 Message-ID: <87tuqwrth8.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The struct tag is actually entry (not ENTRY). The data member has type void *, and it can point to binary data. Only the key member is required to be a null-terminated string. Reviewed-by: Arjun Shankar --- This is for glibc 2.34. manual/search.texi | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/manual/search.texi b/manual/search.texi index 60c851229c..5691bf2f2b 100644 --- a/manual/search.texi +++ b/manual/search.texi @@ -326,24 +326,28 @@ used until the end of the program run. Entries of the hashing table and keys for the search are defined using this type: -@deftp {Data type} {struct ENTRY} -Both elements of this structure are pointers to zero-terminated strings. -This is a limiting restriction of the functionality of the -@code{hsearch} functions. They can only be used for data sets which use -the NUL character always and solely to terminate the records. It is not -possible to handle general binary data. - +@deftp {Data type} ENTRY @table @code @item char *key Pointer to a zero-terminated string of characters describing the key for the search or the element in the hashing table. -@item char *data -Pointer to a zero-terminated string of characters describing the data. -If the functions will be called only for searching an existing entry -this element might stay undefined since it is not used. + +This is a limiting restriction of the functionality of the +@code{hsearch} functions: They can only be used for data sets which +use the NUL character always and solely to terminate keys. It is not +possible to handle general binary data for keys. + +@item void *data +Generic pointer for use by the application. The hashing table +implementation preserves this pointer in entries, but does not use it +in any way otherwise. @end table @end deftp +@deftp {Data type} {struct entry} +The underlying type of @code{ENTRY}. +@end deftp + @deftypefun {ENTRY *} hsearch (ENTRY @var{item}, ACTION @var{action}) @standards{SVID, search.h} @safety{@prelim{}@mtunsafe{@mtasurace{:hsearch}}@asunsafe{}@acunsafe{@acucorrupt{/action==ENTER}}}