Message ID | 20250127151701.2321341-4-christian.couder@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Introduce a "promisor-remote" capability | expand |
On Mon, Jan 27, 2025 at 04:16:58PM +0100, Christian Couder wrote: > As we are going to reuse redact_non_printables() outside "version.c", > let's make it non-static. Missing the DCO. > diff --git a/version.h b/version.h > index 7c62e80577..fcc1816685 100644 > --- a/version.h > +++ b/version.h > @@ -4,7 +4,15 @@ > extern const char git_version_string[]; > extern const char git_built_from_commit_string[]; > > +struct strbuf; > + > const char *git_user_agent(void); > const char *git_user_agent_sanitized(void); > > +/* > + * Trim and replace each character with ascii code below 32 or above > + * 127 (included) using a dot '.' character. > +*/ > +void redact_non_printables(struct strbuf *buf); Is this header really the right spot though? If I want to redact characters I certainly wouldn't be looking at "version.h" for that functionality. Patrick
diff --git a/version.c b/version.c index 4f37b4499d..77423fcaf3 100644 --- a/version.c +++ b/version.c @@ -12,11 +12,7 @@ const char git_version_string[] = GIT_VERSION; const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT; -/* - * Trim and replace each character with ascii code below 32 or above - * 127 (included) using a dot '.' character. - */ -static void redact_non_printables(struct strbuf *buf) +void redact_non_printables(struct strbuf *buf) { strbuf_trim(buf); for (size_t i = 0; i < buf->len; i++) { diff --git a/version.h b/version.h index 7c62e80577..fcc1816685 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,15 @@ extern const char git_version_string[]; extern const char git_built_from_commit_string[]; +struct strbuf; + const char *git_user_agent(void); const char *git_user_agent_sanitized(void); +/* + * Trim and replace each character with ascii code below 32 or above + * 127 (included) using a dot '.' character. +*/ +void redact_non_printables(struct strbuf *buf); + #endif /* VERSION_H */