convert.c: Use 'git_config_string' to get 'smudge' and 'clean'
Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Hetro committed
Jul 5, 2008 at 01:24 UTC
cd8be6c9b64adcb7744aba89bac8ef4261ccacc5
1 file changed
+9
-16
convert.c
+9
-16
@@ -319,8 +319,8 @@ static int apply_filter(const char *path, const char *src, size_t len,
319
static struct convert_driver {
320
const char *name;
321
struct convert_driver *next;
322
- char *smudge;
323
- char *clean;
322
+ const char *smudge;
323
+ const char *clean;
324
} *user_convert, **user_convert_tail;
325
326
static int read_convert_config(const char *var, const char *value, void *cb)
@@ -358,19 +358,12 @@ static int read_convert_config(const char *var, const char *value, void *cb)
358
* The command-line will not be interpolated in any way.
359
*/
360
361
- if (!strcmp("smudge", ep)) {
362
- if (!value)
363
- return config_error_nonbool(var);
364
- drv->smudge = strdup(value);
365
- return 0;
366
- }
361
+ if (!strcmp("smudge", ep))
362
+ return git_config_string(&drv->smudge, var, value);
363
+
364
+ if (!strcmp("clean", ep))
365
+ return git_config_string(&drv->clean, var, value);
366
368
- if (!strcmp("clean", ep)) {
369
- if (!value)
370
- return config_error_nonbool(var);
371
- drv->clean = strdup(value);
372
- return 0;
373
- }
367
return 0;
368
}
369
@@ -576,7 +569,7 @@ int convert_to_git(const char *path, const char *src, size_t len,
569
struct git_attr_check check[3];
570
int crlf = CRLF_GUESS;
571
int ident = 0, ret = 0;
579
- char *filter = NULL;
572
+ const char *filter = NULL;
573
574
setup_convert_check(check);
575
if (!git_checkattr(path, ARRAY_SIZE(check), check)) {
@@ -606,7 +599,7 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc
599
struct git_attr_check check[3];
600
int crlf = CRLF_GUESS;
601
int ident = 0, ret = 0;
609
- char *filter = NULL;
602
+ const char *filter = NULL;
603
604
setup_convert_check(check);
605
if (!git_checkattr(path, ARRAY_SIZE(check), check)) {