Skip to content

Commit 4b3eb77

Browse files
committedApr 5, 2012
Add missing lprintf() calls related to keyword expansion mode for RCS updates.
This requires decoding the keyword expansion mode in the updater rather than in the rcsfile API, but that is more appropriate anyways. To that aim, create a new function rcsfile_setexpand() that accepts the already decoded keyword expansion mode, and remove the decoding/setting code out of rcsfile_setval(). Also remove a redundant lprintf() call in an error code path.
1 parent 0ec31c5 commit 4b3eb77

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed
 

‎rcsfile.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ rcsfile_frompath(const char *path, const char *name, const char *cvsroot,
211211

212212
error = rcsparse(rf, path, ro);
213213
if (error) {
214-
lprintf(-1, "Error parsing \"%s\"\n", name);
215214
rcsfile_free(rf);
216215
return (NULL);
217216
}
@@ -965,9 +964,6 @@ rcsfile_setval(struct rcsfile *rf, int field, char *val, size_t len)
965964
rf->comment = val;
966965
rf->commentlen = len;
967966
break;
968-
case RCSFILE_EXPAND:
969-
rf->expand = keyword_decode_expand(val);
970-
break;
971967
case RCSFILE_DESC:
972968
if (rf->desc != NULL)
973969
free(rf->desc);
@@ -980,6 +976,13 @@ rcsfile_setval(struct rcsfile *rf, int field, char *val, size_t len)
980976
}
981977
}
982978

979+
void
980+
rcsfile_setexpand(struct rcsfile *rf, int expand)
981+
{
982+
983+
rf->expand = expand;
984+
}
985+
983986
void
984987
rcsfile_setstrict(struct rcsfile *rf)
985988
{

‎rcsfile.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
#define RCSFILE_HEAD 0
3333
#define RCSFILE_BRANCH 1
3434
#define RCSFILE_COMMENT 2
35-
#define RCSFILE_EXPAND 3
36-
#define RCSFILE_DESC 4
35+
#define RCSFILE_DESC 3
3736

3837
struct rcsfile;
3938
struct delta;
@@ -56,6 +55,7 @@ void rcsfile_deletetag(struct rcsfile *, char *, char *);
5655
struct delta *rcsfile_getdelta(struct rcsfile *, char *);
5756
void rcsfile_setval(struct rcsfile *, int, char *, size_t);
5857
void rcsfile_setstrict(struct rcsfile *);
58+
void rcsfile_setexpand(struct rcsfile *, int);
5959

6060
/* Functions used for operating on RCS deltas. */
6161
struct delta *rcsfile_addelta(struct rcsfile *, char *, char *, char *,

‎updater.c

+12-5
Original file line numberDiff line numberDiff line change
@@ -1550,9 +1550,9 @@ updater_rcsedit(struct updater *up, struct file_update *fup, char *name,
15501550
struct rcsfile *rf;
15511551
struct fattr *oldfattr;
15521552
char md5[MD5_DIGEST_SIZE];
1553-
char *branch, *cmd, *expand, *line, *path, *revnum, *tag, *temppath;
1553+
char *branch, *cmd, *expandtxt, *line, *path, *revnum, *tag, *temppath;
15541554
char *diffbase, *revdate, *author;
1555-
int error;
1555+
int error, expand;
15561556

15571557
coll = fup->coll;
15581558
sr = &fup->srbuf;
@@ -1650,12 +1650,19 @@ updater_rcsedit(struct updater *up, struct file_update *fup, char *name,
16501650
rcsfile_deleterev(rf, revnum);
16511651
break;
16521652
case 'E':
1653-
expand = proto_get_ascii(&line);
1654-
if (expand == NULL || line != NULL)
1653+
expandtxt = proto_get_ascii(&line);
1654+
if (expandtxt == NULL || line != NULL)
16551655
return (UPDATER_ERR_PROTO);
1656+
expand = keyword_decode_expand(expandtxt);
1657+
if (expand == EXPAND_DEFAULT)
1658+
lprintf(2, " Set keyword expansion "
1659+
"to default\n");
1660+
else
1661+
lprintf(2, " Set keyword expansion "
1662+
"to %s\n", expandtxt);
16561663
UPDATER_OPENRCS(rf, up, path, name,
16571664
coll->co_cvsroot, coll->co_tag);
1658-
rcsfile_setval(rf, RCSFILE_EXPAND, expand, 0);
1665+
rcsfile_setexpand(rf, expand);
16591666
break;
16601667
case 'T':
16611668
tag = proto_get_ascii(&line);

0 commit comments

Comments
 (0)
Please sign in to comment.