chiark
/
gitweb
/
~mdw
/
tig
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bec81df
)
Only touch the option strings if necessary
author
Jonas Fonseca
<fonseca@diku.dk>
Sun, 28 May 2006 18:19:32 +0000
(20:19 +0200)
committer
Jonas Fonseca
<fonseca@antimatter.localdomain>
Sun, 28 May 2006 18:20:22 +0000
(20:20 +0200)
tig.c
patch
|
blob
|
blame
|
history
diff --git
a/tig.c
b/tig.c
index a3db54baa7c066f0a67dc121f7f967ff5b9abc5b..982c1cc8a0eee0ce591d10fad17838aae2d62e32 100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-845,6
+845,10
@@
struct line {
};
};
+/*
+ * User config file handling.
+ */
+
#define set_color(color, name, namelen) \
set_from_int_map(color_map, ARRAY_SIZE(color_map), color, name, namelen)
#define set_color(color, name, namelen) \
set_from_int_map(color_map, ARRAY_SIZE(color_map), color, name, namelen)
@@
-855,19
+859,20
@@
static int
read_option(char *opt, int optlen, char *value, int valuelen)
{
optlen = strcspn(opt, "#;");
read_option(char *opt, int optlen, char *value, int valuelen)
{
optlen = strcspn(opt, "#;");
- if (optlen == 0)
+ if (optlen == 0)
{
/* The whole line is a comment. */
return OK;
/* The whole line is a comment. */
return OK;
- else if (opt[optlen] != 0)
+ } else if (opt[optlen] != 0) {
/* Part of the option name is a comment, so the value part
* should be ignored. */
valuelen = 0;
/* Part of the option name is a comment, so the value part
* should be ignored. */
valuelen = 0;
- else
+ opt[optlen] = value[valuelen] = 0;
+ } else {
/* Else look for comment endings in the value. */
valuelen = strcspn(value, "#;");
/* Else look for comment endings in the value. */
valuelen = strcspn(value, "#;");
-
- opt[optlen] = value[valuelen] = 0;
+ value[valuelen] = 0;
+ }
/* Reads: "color" object fgcolor bgcolor [attr] */
if (!strcmp(opt, "color")) {
/* Reads: "color" object fgcolor bgcolor [attr] */
if (!strcmp(opt, "color")) {