[asterisk-commits] murf: branch 1.6.0 r157303 - in /branches/1.6.0: ./ main/config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 18 12:10:34 CST 2008
Author: murf
Date: Tue Nov 18 12:10:34 2008
New Revision: 157303
URL: http://svn.digium.com/view/asterisk?view=rev&rev=157303
Log:
Merged revisions 157302 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r157302 | murf | 2008-11-18 11:07:55 -0700 (Tue, 18 Nov 2008) | 18 lines
(closes issue #13420)
Reported by: alex70
Patches:
13420.13539.patch uploaded by murf (license 17)
Tested by: murf, awk
This fixes two problems: a spurious linefeed insertion
probably left over from pre-precomment times. Only
generated when category had no previous comments.
The other problem: Insertions could get the line-numbering
out of whack and generate negative line numbers, causing
chunks of line numbers to be emitted, on the scale of the
number of lines up to that point in the file. In such cases,
abort the looping, and all is well.
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/config.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/main/config.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/config.c?view=diff&rev=157303&r1=157302&r2=157303
==============================================================================
--- branches/1.6.0/main/config.c (original)
+++ branches/1.6.0/main/config.c Tue Nov 18 12:10:34 2008
@@ -1525,7 +1525,10 @@
stored in the precomments, but not printed back out.
I did have to make sure that comments following
the ;! header comments were not also deleted in the process */
- for (i=fi->lineno;i<lineno - precomment_lines; i++) {
+ if (lineno - precomment_lines - fi->lineno < 0) { /* insertions can mess up the line numbering and produce negative numbers that mess things up */
+ return;
+ }
+ for (i=fi->lineno; i<lineno - precomment_lines; i++) {
fprintf(fp,"\n");
}
fi->lineno = lineno+1; /* Advance the file lineno */
@@ -1609,7 +1612,7 @@
}
}
}
-
+
insert_leading_blank_lines(f, fi, cat->precomments, cat->lineno);
/* Dump section with any appropriate comment */
for (cmt = cat->precomments; cmt; cmt=cmt->next) {
@@ -1623,8 +1626,6 @@
if (cmtp)
fprintf(f,"%s", cmtp);
}
- if (!cat->precomments)
- fprintf(f,"\n");
fprintf(f, "[%s]", cat->name);
if (cat->ignored || !AST_LIST_EMPTY(&cat->template_instances)) {
fprintf(f, "(");
More information about the asterisk-commits
mailing list