From: Ben Pfaff Date: Thu, 10 Mar 2011 06:10:48 +0000 (-0800) Subject: str: Rename ss_chomp() to ss_chomp_byte(), ds_chomp() to ds_chomp_byte(). X-Git-Tag: v0.7.7~28 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=086322fd8c85a303ba6f552950d6f057f2867add;p=pspp-builds.git str: Rename ss_chomp() to ss_chomp_byte(), ds_chomp() to ds_chomp_byte(). This paves the way for new functions that chomp an entire substring. --- diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index 24e3272a..ecff0577 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -527,7 +527,7 @@ do_repeat_filter (struct getl_interface *interface, struct string *line) /* Strip trailing whitespace, check for & remove terminal dot. */ ds_rtrim (line, ss_cstr (CC_SPACES)); - dot = ds_chomp (line, '.'); + dot = ds_chomp_byte (line, '.'); input = ds_ss (line); in_apos = in_quote = false; while ((c = ss_first (input)) != EOF) diff --git a/src/language/data-io/data-reader.c b/src/language/data-io/data-reader.c index 7c9e4e67..87fa8c92 100644 --- a/src/language/data-io/data-reader.c +++ b/src/language/data-io/data-reader.c @@ -343,7 +343,7 @@ read_file_record (struct dfm_reader *r) case FH_MODE_TEXT: if (ds_read_line (&r->line, r->file, SIZE_MAX)) { - ds_chomp (&r->line, '\n'); + ds_chomp_byte (&r->line, '\n'); return true; } else diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index eee15d64..938d2667 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -908,7 +908,7 @@ lex_preprocess_line (struct string *line, { strip_comments (line); ds_rtrim (line, ss_cstr (CC_SPACES)); - *line_ends_command = ds_chomp (line, '.') || ds_is_empty (line); + *line_ends_command = ds_chomp_byte (line, '.') || ds_is_empty (line); *line_starts_command = false; if (syntax == GETL_BATCH) { diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index 319e19a3..241ad7c1 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -453,7 +453,7 @@ parse_aggregate_functions (struct lexer *lexer, const struct dictionary *dict, } ds_assign_substring (&function_name, lex_tokss (lexer)); - exclude = ds_chomp (&function_name, '.') ? MV_SYSTEM : MV_ANY; + exclude = ds_chomp_byte (&function_name, '.') ? MV_SYSTEM : MV_ANY; for (function = agr_func_tab; function->name; function++) if (!strcasecmp (function->name, ds_cstr (&function_name))) diff --git a/src/language/syntax-file.c b/src/language/syntax-file.c index c5636088..286ce1e3 100644 --- a/src/language/syntax-file.c +++ b/src/language/syntax-file.c @@ -95,7 +95,7 @@ read_syntax_file (struct getl_interface *s, msg (ME, _("Reading `%s': %s."), sfs->fn, strerror (errno)); return false; } - ds_chomp (line, '\n'); + ds_chomp_byte (line, '\n'); } while (sfs->ln == 1 && !memcmp (ds_cstr (line), "#!", 2)); diff --git a/src/libpspp/str.c b/src/libpspp/str.c index 25e2cfd5..e34c150d 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 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 @@ -416,7 +416,7 @@ ss_trim (struct substring *ss, struct substring trim_set) /* If the last byte in SS is C, removes it and returns true. Otherwise, returns false without changing the string. */ bool -ss_chomp (struct substring *ss, char c) +ss_chomp_byte (struct substring *ss, char c) { if (ss_last (*ss) == c) { @@ -1036,9 +1036,9 @@ ds_trim (struct string *st, struct substring trim_set) /* If the last byte in ST is C, removes it and returns true. Otherwise, returns false without modifying ST. */ bool -ds_chomp (struct string *st, char c) +ds_chomp_byte (struct string *st, char c) { - return ss_chomp (&st->ss, c); + return ss_chomp_byte (&st->ss, c); } /* Divides ST into tokens separated by any of the DELIMITERS. @@ -1358,7 +1358,7 @@ ds_read_config_line (struct string *st, int *line_number, FILE *stream) (*line_number)++; ds_rtrim (st, ss_cstr (CC_SPACES)); } - while (ds_chomp (st, '\\')); + while (ds_chomp_byte (st, '\\')); remove_comment (st); return true; diff --git a/src/libpspp/str.h b/src/libpspp/str.h index c691f9f2..d2b39ef5 100644 --- a/src/libpspp/str.h +++ b/src/libpspp/str.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 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 @@ -98,7 +98,7 @@ void ss_truncate (struct substring *, size_t); size_t ss_rtrim (struct substring *, struct substring trim_set); size_t ss_ltrim (struct substring *, struct substring trim_set); void ss_trim (struct substring *, struct substring trim_set); -bool ss_chomp (struct substring *, char); +bool ss_chomp_byte (struct substring *, char); bool ss_separate (struct substring src, struct substring delimiters, size_t *save_idx, struct substring *token); bool ss_tokenize (struct substring src, struct substring delimiters, @@ -177,7 +177,7 @@ void ds_truncate (struct string *, size_t); size_t ds_rtrim (struct string *, struct substring trim_set); size_t ds_ltrim (struct string *, struct substring trim_set); size_t ds_trim (struct string *, struct substring trim_set); -bool ds_chomp (struct string *, char); +bool ds_chomp_byte (struct string *, char); bool ds_separate (const struct string *src, struct substring delimiters, size_t *save_idx, struct substring *token); bool ds_tokenize (const struct string *src, struct substring delimiters, diff --git a/src/ui/gui/text-data-import-dialog.c b/src/ui/gui/text-data-import-dialog.c index e5c48fdb..534cec9e 100644 --- a/src/ui/gui/text-data-import-dialog.c +++ b/src/ui/gui/text-data-import-dialog.c @@ -476,8 +476,8 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window) destroy_file (ia); return false; } - ds_chomp (line, '\n'); - ds_chomp (line, '\r'); + ds_chomp_byte (line, '\n'); + ds_chomp_byte (line, '\r'); } if (file->line_cnt == 0)