From efe9bbc0d69cb99a492da9b4c196437054cc4051 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Tue, 20 Jan 2026 22:27:54 +0300 Subject: [PATCH] inline getprogname replacement Forwarded: not-needed Inline getprogname() by using program_invocation_short_name when available (like with glibc). This makes a lot of binaries to avoid linkage to libreplace. This is a short and dirty version, proper change for upstream should clean up #ifdef'fery in replace.c. Gbp-Pq: Name inline-getprogname.diff --- lib/replace/replace.c | 2 +- lib/replace/replace.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 33cbbec1..b0e1edbd 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -1144,7 +1144,7 @@ void *rep_memset_explicit(void *block, int c, size_t size) } #endif -#ifndef HAVE_GETPROGNAME +#if !defined(HAVE_GETPROGNAME) && !defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME) # ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME # define PROGNAME_SIZE 32 static char rep_progname[PROGNAME_SIZE]; diff --git a/lib/replace/replace.h b/lib/replace/replace.h index da5cc5be..9d75ceae 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -1012,9 +1012,13 @@ void *rep_memset_explicit(void *block, int c, size_t size); #endif #ifndef HAVE_GETPROGNAME +#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME +# define getprogname() (program_invocation_short_name) +#else #define getprogname rep_getprogname const char *rep_getprogname(void); #endif +#endif #ifndef HAVE_COPY_FILE_RANGE #define copy_file_range rep_copy_file_range -- 2.30.2