From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C82BF1581D3 for ; Tue, 14 May 2024 00:05:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AEDA1E2A9A; Tue, 14 May 2024 00:05:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5A008E2A9A for ; Tue, 14 May 2024 00:05:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DC618335D2B for ; Tue, 14 May 2024 00:05:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 21E1D15F8 for ; Tue, 14 May 2024 00:05:20 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1715636062.bc8ced13c5a987a9f1b0ac6d425d00d580d09519.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: ecma48-cpr.c X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: bc8ced13c5a987a9f1b0ac6d425d00d580d09519 X-VCS-Branch: master Date: Tue, 14 May 2024 00:05:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 0f4cbffc-c989-4431-b07c-2ff71caa4d25 X-Archives-Hash: d31f94b130503fa7c5e6e09924557c92 commit: bc8ced13c5a987a9f1b0ac6d425d00d580d09519 Author: Kerin Millar plushkava net> AuthorDate: Mon May 13 21:34:22 2024 +0000 Commit: Sam James gentoo org> CommitDate: Mon May 13 21:34:22 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=bc8ced13 ecma48-cpr: Use designated initialisers for legibility Signed-off-by: Kerin Millar plushkava.net> ecma48-cpr.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/ecma48-cpr.c b/ecma48-cpr.c index 5a0f936..d910f6f 100644 --- a/ecma48-cpr.c +++ b/ecma48-cpr.c @@ -92,10 +92,11 @@ main(void) { * Prepare to catch our signals. We treat both an interrupt and a * depleted timer as essentially the same thing: fatal errors. */ - struct sigaction act; - act.sa_handler = on_signal; + struct sigaction act = { + .sa_handler = on_signal, + .sa_flags = 0 + }; sigemptyset(&act.sa_mask); - act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); @@ -190,19 +191,21 @@ main(void) { #ifndef __APPLE__ static timer_t init_timer(void) { - struct itimerspec timer; - struct sigevent event; timer_t timerid; - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGALRM; - event.sigev_value.sival_ptr = &timerid; + struct sigevent event = { + .sigev_value.sival_ptr = &timerid, + .sigev_notify = SIGEV_SIGNAL, + .sigev_signo = SIGALRM + }; if (timer_create(CLOCK_REALTIME, &event, &timerid) == -1) { die("failed to create a per-process timer"); } else { - timer.it_value.tv_sec = 0; - timer.it_value.tv_nsec = READ_TIMEOUT_NS; - timer.it_interval.tv_sec = 0; - timer.it_interval.tv_nsec = 0; + struct itimerspec timer = { + .it_value.tv_nsec = READ_TIMEOUT_NS, + .it_interval.tv_nsec = 0, + .it_interval.tv_sec = 0, + .it_value.tv_sec = 0 + }; if (timer_settime(timerid, 0, &timer, NULL) == -1) { die("failed to configure the per-process timer"); }