From patchwork Mon Jun 26 21:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 51381 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9F36F27BBEA; Mon, 26 Jun 2023 23:09:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 03BBA27BBE2 for ; Mon, 26 Jun 2023 23:09:53 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDuNR-00076D-FH; Mon, 26 Jun 2023 18:08:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDuNP-0006ua-2I for guix-patches@gnu.org; Mon, 26 Jun 2023 18:08:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDuNO-0007PV-Pl for guix-patches@gnu.org; Mon, 26 Jun 2023 18:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDuNO-0000CU-Fh for guix-patches@gnu.org; Mon, 26 Jun 2023 18:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH v3 01/11] services: configuration: Simplify normalize-extra-args. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 22:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.1687817222677 (code B ref 63985); Mon, 26 Jun 2023 22:08:02 +0000 Received: (at 63985) by debbugs.gnu.org; 26 Jun 2023 22:07:02 +0000 Received: from localhost ([127.0.0.1]:47216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuMQ-0000Am-3w for submit@debbugs.gnu.org; Mon, 26 Jun 2023 18:07:02 -0400 Received: from smtpm1.myservices.hosting ([185.26.105.232]:59692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuMO-0000Aa-Ob for 63985@debbugs.gnu.org; Mon, 26 Jun 2023 18:07:01 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm1.myservices.hosting (Postfix) with ESMTP id ADCF520512 for <63985@debbugs.gnu.org>; Tue, 27 Jun 2023 00:06:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 6D48480099; Mon, 26 Jun 2023 23:59:45 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m87NYcERUslH; Mon, 26 Jun 2023 23:59:45 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id E8E8E80060; Mon, 26 Jun 2023 23:59:44 +0200 (CEST) From: Bruno Victal Date: Mon, 26 Jun 2023 22:59:27 +0100 Message-Id: <22471a74b258f7169961898eed9e18cee7504f60.1687816734.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/configuration.scm (define-configuration-helper, normalize-extra-args): Use #f instead of %unset-value. --- gnu/services/configuration.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) base-commit: ac86174e22fcd762893bd4515786b1376af9397b diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 367b85c1be..dafe72f4fe 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -190,32 +190,32 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (define (normalize-extra-args s) "Extract and normalize arguments following @var{doc}." (let loop ((s s) - (sanitizer* %unset-value) - (serializer* %unset-value)) + (sanitizer* #f) + (serializer* #f)) (syntax-case s (sanitizer serializer empty-serializer) (((sanitizer proc) tail ...) - (if (maybe-value-set? sanitizer*) - (syntax-violation 'sanitizer "duplicate entry" - #'proc) + (if sanitizer* + (syntax-violation 'sanitizer + "duplicate entry" #'proc) (loop #'(tail ...) #'proc serializer*))) (((serializer proc) tail ...) - (if (maybe-value-set? serializer*) - (syntax-violation 'serializer "duplicate or conflicting entry" - #'proc) + (if serializer* + (syntax-violation 'serializer + "duplicate or conflicting entry" #'proc) (loop #'(tail ...) sanitizer* #'proc))) ((empty-serializer tail ...) - (if (maybe-value-set? serializer*) + (if serializer* (syntax-violation 'empty-serializer "duplicate or conflicting entry" #f) (loop #'(tail ...) sanitizer* #'empty-serializer))) (() ; stop condition (values (list sanitizer* serializer*))) ((proc) ; TODO: deprecated, to be removed. - (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) + (every not (list sanitizer* serializer*)) (begin (warning #f (G_ "specifying serializers after documentation is \ deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) - (values (list %unset-value #'proc))))))) + (values (list #f #'proc))))))) (syntax-case syn () ((_ stem (field field-type+def doc extra-args ...) ...) @@ -239,11 +239,11 @@ (define (define-configuration-helper serialize? serializer-prefix syn) default-value)) #'((field-type def) ...))) ((field-sanitizer ...) - (map maybe-value #'(sanitizer* ...))) + #'(sanitizer* ...)) ((field-serializer ...) (map (lambda (type proc) (and serialize? - (or (maybe-value proc) + (or proc (if serializer-prefix (id #'stem serializer-prefix #'serialize- type) (id #'stem #'serialize- type)))))