Skip to content

Commit 3456b21

Browse files
author
_
committed
minor simplifications
1 parent 198f0ed commit 3456b21

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pfa.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static void pyformat(FILE *file, FILE *out, struct vlbuf *origfile,
229229
if (origfile) {
230230
if (origfile->len < rlen + origfilelen)
231231
vlbuf_expand(origfile, rlen + origfilelen);
232-
strncpy(&origfile->d.ch[origfilelen], &linebuf.d.ch[llen], rlen);
232+
memcpy(&origfile->d.ch[origfilelen], &linebuf.d.ch[llen], rlen + 1);
233233
origfilelen += rlen;
234234
}
235235
llen += rlen;
@@ -536,6 +536,7 @@ static void pyformat(FILE *file, FILE *out, struct vlbuf *origfile,
536536
++tokd;
537537
/* convert label to special if it's a word in a list we have */
538538
if (otok == TOK_LABEL) {
539+
/* todo: run constructed state machine to check if word in group. */
539540
for (const char **cc = &specnames[0]; *cc; ++cc) {
540541
if (strcmp(*cc, stokd) == 0) {
541542
otok = TOK_SPECIAL;
@@ -617,7 +618,6 @@ static void pyformat(FILE *file, FILE *out, struct vlbuf *origfile,
617618
buildpt += strapp(buildpt, "# ");
618619
}
619620
buildpt += strapp(buildpt, sos);
620-
buildpt += strapp(buildpt, "!#");
621621
splitpoints.d.in[nsplits] = buildpt - laccum.d.ch;
622622
split_ratings.d.in[nsplits] = -1;
623623
split_nestings.d.in[nsplits] = nests;
@@ -719,9 +719,6 @@ static void pyformat(FILE *file, FILE *out, struct vlbuf *origfile,
719719
int fr = i > 0 ? splitpoints.d.in[i - 1] : 0;
720720
int to = i >= nsplits - 1 ? eoff : splitpoints.d.in[i];
721721
memcpy(lineout.d.ch, &laccum.d.ch[fr], to - fr);
722-
if (split_ratings.d.in[i] < 0) {
723-
to -= 2;
724-
}
725722
lineout.d.ch[to - fr] = '\0';
726723
int nlen = to - fr;
727724
int force_split = i > 0 ? split_ratings.d.in[i - 1] < 0 : 0;
@@ -733,9 +730,6 @@ static void pyformat(FILE *file, FILE *out, struct vlbuf *origfile,
733730
int fr = k > 0 ? splitpoints.d.in[k - 1] : 0;
734731
int ofr = k > 1 ? splitpoints.d.in[k - 2] : 0;
735732
int to = k >= nsplits - 1 ? eoff : splitpoints.d.in[k];
736-
if (split_ratings.d.in[k] < 0) {
737-
to -= 2;
738-
}
739733
int len = to - fr;
740734
int isc = 100;
741735
/* Just by previous. Q: split tok? or 'saved length' field, w/

0 commit comments

Comments
 (0)