[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
style: formatting changes
From: |
Akim Demaille |
Subject: |
style: formatting changes |
Date: |
Fri, 26 Feb 2021 07:17:23 +0100 |
commit 4511e43245942c904bc7e9a7cf45db59ff17e63e
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Fri Feb 26 07:02:55 2021 +0100
style: formatting changes
* src/files.c, src/files.h: Save horizontal space.
Prefer `res` for returned values.
Put the doc into the header.
diff --git a/src/files.c b/src/files.c
index c0d5d1ca7..72652f426 100644
--- a/src/files.c
+++ b/src/files.c
@@ -201,12 +201,12 @@ map_file_name (char const *filename)
size_t oldprefix_len = strlen (p->oldprefix);
size_t newprefix_len = strlen (p->newprefix);
- char *s = xmalloc (newprefix_len + strlen (filename) - oldprefix_len + 1);
+ char *res = xmalloc (newprefix_len + strlen (filename) - oldprefix_len + 1);
- char *end = stpcpy (s, p->newprefix);
+ char *end = stpcpy (res, p->newprefix);
stpcpy (end, filename + oldprefix_len);
- return s;
+ return res;
}
static void
@@ -217,17 +217,16 @@ prefix_map_free (struct prefix_map *p)
free (p);
}
-/* Adds a new file prefix mapping. If a file path starts with oldprefix, it
- will be replaced with newprefix */
void
add_prefix_map (char const *oldprefix, char const *newprefix)
{
if (!prefix_maps)
- prefix_maps = gl_list_create_empty (GL_ARRAY_LIST,
- /* equals */ NULL,
- /* hashcode */ NULL,
- (gl_listelement_dispose_fn)
prefix_map_free,
- true);
+ prefix_maps
+ = gl_list_create_empty (GL_ARRAY_LIST,
+ /* equals */ NULL,
+ /* hashcode */ NULL,
+ (gl_listelement_dispose_fn) prefix_map_free,
+ true);
struct prefix_map *p = xmalloc (sizeof (*p));
p->oldprefix = xstrdup (oldprefix);
diff --git a/src/files.h b/src/files.h
index e84497115..d49847abc 100644
--- a/src/files.h
+++ b/src/files.h
@@ -95,6 +95,9 @@ void xfclose (FILE *ptr);
FILE *xfdopen (int fd, char const *mode);
char *map_file_name (char const *filename);
+
+/* Add a new file prefix mapping. If a file path starts with
+ oldprefix, it will be replaced with newprefix. */
void add_prefix_map (char const *oldprefix, char const *newprefix);
#endif /* !FILES_H_ */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- style: formatting changes,
Akim Demaille <=