From: Ben Pfaff Date: Sun, 24 Apr 2011 04:59:38 +0000 (-0700) Subject: dissect-sysfile: Don't omit the last in a series of text tokens. X-Git-Tag: v0.7.8~44 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=5bfbebe93fba98a3b5c1f64482823d53265aed5b dissect-sysfile: Don't omit the last in a series of text tokens. Otherwise dissect-sysfile would not print the last long string variable name written by sys-file-writer, because it did not include a separator byte after the last record. (This was obvious running dissect-sysfile on a system file with only one variable.) --- diff --git a/tests/dissect-sysfile.c b/tests/dissect-sysfile.c index 444c15cc..7ae92bfc 100644 --- a/tests/dissect-sysfile.c +++ b/tests/dissect-sysfile.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1202,7 +1202,7 @@ text_tokenize (struct text_record *text, int delimiter) && text->buffer[text->pos] != delimiter && text->buffer[text->pos] != '\0') text->pos++; - if (text->pos == text->size) + if (start == text->pos) return NULL; text->buffer[text->pos++] = '\0'; return &text->buffer[start];