git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use const for interpolate arguments

From
Alex Riesen <fork0@t-online.de>
Date
Sep 25, 2006, 21:19 UTC
Message-ID
<20060925211900.GB6125@steel.home>
In-Reply-To
<E1GPqwJ-0002xt-Bt@jdl.com>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
Resending. jdl.com blacklisted my IP, for whatever it has done to him.
 interpolate.c |    6 +++---
 interpolate.h |    9 +++++++--
 2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/interpolate.c b/interpolate.c
index d82f1b5..4570c12 100644
--- a/interpolate.c
+++ b/interpolate.c
@@ -25,10 +25,10 @@ #include "interpolate.h"
  */
 
 int interpolate(char *result, int reslen,
-		char *orig,
-		struct interp *interps, int ninterps)
+		const char *orig,
+		const struct interp *interps, int ninterps)
 {
-	char *src = orig;
+	const char *src = orig;
 	char *dest = result;
 	int newlen = 0;
 	char *name, *value;
diff --git a/interpolate.h b/interpolate.h
index 00c63a5..d16f924 100644
--- a/interpolate.h
+++ b/interpolate.h
@@ -5,6 +5,11 @@
 #ifndef INTERPOLATE_H
 #define INTERPOLATE_H
 
+/*
+ * Convert a NUL-terminated string in buffer orig,
+ * performing substitutions on %-named sub-strings from
+ * the interpretation table.
+ */
 
 struct interp {
 	char *name;
@@ -12,7 +17,7 @@ struct interp {
 };
 
 extern int interpolate(char *result, int reslen,
-		       char *orig,
-		       struct interp *interps, int ninterps);
+		       const char *orig,
+		       const struct interp *interps, int ninterps);
 
 #endif /* INTERPOLATE_H */
-- 
1.4.2.1.g6b47-dirty
Previous: Alex Riesen
Message 3 of 3 in “Add virtualization support to git-daemon”
  1. Add virtualization support to git-daemonJon Loeliger, Sep 20, 2006
  2. Use const for interpolate argumentsAlex Riesen, Sep 25, 2006
  3. Use const for interpolate argumentsAlex Riesen, Sep 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.