From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (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 lists.proxmox.com (Postfix) with ESMTPS id 970A29349F for ; Mon, 19 Feb 2024 18:56:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6F3AF340CA for ; Mon, 19 Feb 2024 18:56:01 +0100 (CET) Received: from nena.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP for ; Mon, 19 Feb 2024 18:56:00 +0100 (CET) Received: by nena.proxmox.com (Postfix, from userid 1000) id D0D32E7698; Mon, 19 Feb 2024 18:56:00 +0100 (CET) From: Mira Limbeck To: pmg-devel@lists.proxmox.com Date: Mon, 19 Feb 2024 18:55:46 +0100 Message-Id: <20240219175548.311288-4-m.limbeck@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219175548.311288-1-m.limbeck@proxmox.com> References: <20240219175548.311288-1-m.limbeck@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.671 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pmg-devel] [PATCH v2 pmg-log-tracker 4/5] cleanup: remove unused strftime function X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2024 17:56:31 -0000 since we switched to proxmox_time::strftime_local for printing the start and end times using local time, the strftime functions in src/time.rs is unused and can be removed Signed-off-by: Mira Limbeck --- cleanup commit that depends on patch 1/5, only apply if patch 1/5 is applied. src/time.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/time.rs b/src/time.rs index 9a2ce73..d26dccd 100644 --- a/src/time.rs +++ b/src/time.rs @@ -59,13 +59,6 @@ impl fmt::Debug for Tm { /// These are now exposed via `libc`, but they're part of glibc. mod imports { extern "C" { - pub fn strftime( - s: *mut libc::c_char, - max: libc::size_t, - format: *const libc::c_char, - tm: *const libc::tm, - ) -> libc::size_t; - pub fn strptime( s: *const libc::c_char, format: *const libc::c_char, @@ -123,30 +116,6 @@ impl Tm { } } -/// Wrapper around `strftime(3)` to format time strings. -pub fn strftime(format: &CStr, tm: &Tm) -> Result { - let mut buf = MaybeUninit::<[u8; 64]>::uninit(); - - let size = unsafe { - imports::strftime( - buf.as_mut_ptr() as *mut libc::c_char, - 64, - format.as_ptr(), - &tm.0, - ) - }; - if size == 0 { - bail!("failed to format time"); - } - let size = size as usize; - - let buf = unsafe { buf.assume_init() }; - - std::str::from_utf8(&buf[..size]) - .map_err(|_| format_err!("formatted time was not valid utf-8")) - .map(str::to_string) -} - /// Wrapper around `strptime(3)` to parse time strings. pub fn strptime(time: &str, format: &CStr) -> Result { // zero memory because strptime does not necessarily initialize tm_isdst, tm_gmtoff and tm_zone -- 2.39.2