From: John Darrington Date: Fri, 21 Dec 2007 23:49:36 +0000 (+0000) Subject: Made case_{reader,writer}_class structures const. X-Git-Tag: v0.6.0~153 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc6a060446e71cace2d828a864c85702e04aba7c;p=pspp-builds.git Made case_{reader,writer}_class structures const. --- diff --git a/src/data/casereader-filter.c b/src/data/casereader-filter.c index 969bb4fa..37e1dc85 100644 --- a/src/data/casereader-filter.c +++ b/src/data/casereader-filter.c @@ -43,7 +43,7 @@ struct casereader_filter struct casewriter *exclude; /* Writer that gets filtered cases, or NULL. */ }; -static struct casereader_class casereader_filter_class; +static const struct casereader_class casereader_filter_class; /* Creates and returns a casereader whose content is a filtered version of the data in SUBREADER. Only the cases for which @@ -130,7 +130,7 @@ casereader_filter_destroy (struct casereader *reader, void *filter_) } /* Filtering casereader class. */ -static struct casereader_class casereader_filter_class = +static const struct casereader_class casereader_filter_class = { casereader_filter_read, casereader_filter_destroy, diff --git a/src/data/casereader-provider.h b/src/data/casereader-provider.h index 43c980a8..77220981 100644 --- a/src/data/casereader-provider.h +++ b/src/data/casereader-provider.h @@ -111,7 +111,7 @@ casereader_create_sequential (const struct taint *, size_t value_cnt, casenumber case_cnt, const struct casereader_class *, void *); -void *casereader_dynamic_cast (struct casereader *, struct casereader_class *); +void *casereader_dynamic_cast (struct casereader *, const struct casereader_class *); /* Casereader class for random-access data sources. */ struct casereader_random_class diff --git a/src/data/casereader-translator.c b/src/data/casereader-translator.c index 5a717da8..b857b5b8 100644 --- a/src/data/casereader-translator.c +++ b/src/data/casereader-translator.c @@ -38,7 +38,7 @@ struct casereader_translator void *aux; }; -static struct casereader_class casereader_translator_class; +static const struct casereader_class casereader_translator_class; /* Creates and returns a new casereader whose cases are produced by reading from SUBREADER and passing through TRANSLATE, which @@ -103,7 +103,7 @@ casereader_translator_destroy (struct casereader *reader UNUSED, void *ct_) } /* Casereader class for translating casereader. */ -static struct casereader_class casereader_translator_class = +static const struct casereader_class casereader_translator_class = { casereader_translator_read, casereader_translator_destroy, diff --git a/src/data/casereader.c b/src/data/casereader.c index e6d859c9..092f7708 100644 --- a/src/data/casereader.c +++ b/src/data/casereader.c @@ -356,7 +356,7 @@ casereader_create_sequential (const struct taint *taint, casereader to be replaced by a shim caseader). */ void * casereader_dynamic_cast (struct casereader *reader, - struct casereader_class *class) + const struct casereader_class *class) { return reader->class == class ? reader->aux : NULL; } @@ -393,7 +393,7 @@ struct random_reader_shared void *aux; }; -static struct casereader_class random_reader_casereader_class; +static const struct casereader_class random_reader_casereader_class; /* Creates and returns a new random_reader with the given SHARED data and OFFSET. Inserts the new random reader into the @@ -541,7 +541,7 @@ random_reader_peek (struct casereader *reader, void *br_, } /* Casereader class for random reader. */ -static struct casereader_class random_reader_casereader_class = +static const struct casereader_class random_reader_casereader_class = { random_reader_read, random_reader_destroy, @@ -580,7 +580,7 @@ struct shim struct casereader *subreader; /* Subordinate casereader. */ }; -static struct casereader_random_class shim_class; +static const struct casereader_random_class shim_class; /* Interposes a buffering shim atop READER. */ static void @@ -646,7 +646,7 @@ shim_advance (struct casereader *reader UNUSED, void *b_, casenumber case_cnt) } /* Class for the buffered reader. */ -static struct casereader_random_class shim_class = +static const struct casereader_random_class shim_class = { shim_read, shim_destroy, diff --git a/src/data/casewriter-translator.c b/src/data/casewriter-translator.c index 79694a46..c630b44c 100644 --- a/src/data/casewriter-translator.c +++ b/src/data/casewriter-translator.c @@ -34,7 +34,7 @@ struct casewriter_translator void *aux; }; -static struct casewriter_class casewriter_translator_class; +static const struct casewriter_class casewriter_translator_class; /* Creates and returns a new casewriter whose cases are passed through TRANSLATE, which must create case OUTPUT, with @@ -101,7 +101,7 @@ casewriter_translator_convert_to_reader (struct casewriter *writer UNUSED, return reader; } -static struct casewriter_class casewriter_translator_class = +static const struct casewriter_class casewriter_translator_class = { casewriter_translator_write, casewriter_translator_destroy, diff --git a/src/data/gnumeric-reader.c b/src/data/gnumeric-reader.c index cc8d335b..418d63c2 100644 --- a/src/data/gnumeric-reader.c +++ b/src/data/gnumeric-reader.c @@ -63,7 +63,7 @@ static void gnm_file_casereader_destroy (struct casereader *, void *); static bool gnm_file_casereader_read (struct casereader *, void *, struct ccase *); -static struct casereader_class gnm_file_casereader_class = +static const struct casereader_class gnm_file_casereader_class = { gnm_file_casereader_read, gnm_file_casereader_destroy, diff --git a/src/data/lazy-casereader.c b/src/data/lazy-casereader.c index 8c604bce..2cb8911f 100644 --- a/src/data/lazy-casereader.c +++ b/src/data/lazy-casereader.c @@ -35,7 +35,7 @@ struct lazy_casereader void *aux; }; -static struct casereader_class lazy_casereader_class; +static const struct casereader_class lazy_casereader_class; /* Creates and returns a new lazy casereader that will instantiate its underlying casereader, if necessary, by @@ -152,7 +152,7 @@ lazy_casereader_peek (struct casereader *reader, void *lc_, return casereader_peek (reader, idx, c); } -static struct casereader_class lazy_casereader_class = +static const struct casereader_class lazy_casereader_class = { lazy_casereader_read, lazy_casereader_do_destroy, diff --git a/src/data/por-file-reader.c b/src/data/por-file-reader.c index b5486a4a..3f2cdd46 100644 --- a/src/data/por-file-reader.c +++ b/src/data/por-file-reader.c @@ -79,7 +79,7 @@ struct pfm_reader bool ok; /* Set false on I/O error. */ }; -static struct casereader_class por_file_casereader_class; +static const struct casereader_class por_file_casereader_class; static void error (struct pfm_reader *r, const char *msg,...) @@ -894,7 +894,7 @@ pfm_detect (FILE *file) return true; } -static struct casereader_class por_file_casereader_class = +static const struct casereader_class por_file_casereader_class = { por_file_casereader_read, por_file_casereader_destroy, diff --git a/src/data/por-file-writer.c b/src/data/por-file-writer.c index fad89bf7..1f348f67 100644 --- a/src/data/por-file-writer.c +++ b/src/data/por-file-writer.c @@ -77,7 +77,7 @@ struct pfm_var int fv; /* Starting case index. */ }; -static struct casewriter_class por_file_casewriter_class; +static const struct casewriter_class por_file_casewriter_class; static bool close_writer (struct pfm_writer *); static void buf_write (struct pfm_writer *, const void *, size_t); @@ -898,7 +898,7 @@ format_trig_double (long double value, int base_10_precision, char output[]) return; } -static struct casewriter_class por_file_casewriter_class = +static const struct casewriter_class por_file_casewriter_class = { por_file_casewriter_write, por_file_casewriter_destroy, diff --git a/src/data/procedure.c b/src/data/procedure.c index 278077e7..98414a2b 100644 --- a/src/data/procedure.c +++ b/src/data/procedure.c @@ -137,7 +137,7 @@ proc_execute (struct dataset *ds) return proc_commit (ds) && ok; } -static struct casereader_class proc_casereader_class; +static const struct casereader_class proc_casereader_class; /* Opens dataset DS for reading cases with proc_read. proc_commit must be called when done. */ @@ -344,7 +344,7 @@ proc_commit (struct dataset *ds) } /* Casereader class for procedure execution. */ -static struct casereader_class proc_casereader_class = +static const struct casereader_class proc_casereader_class = { proc_casereader_read, proc_casereader_destroy, diff --git a/src/data/scratch-writer.c b/src/data/scratch-writer.c index e4d977fb..ed88af6d 100644 --- a/src/data/scratch-writer.c +++ b/src/data/scratch-writer.c @@ -46,7 +46,7 @@ struct scratch_writer struct casewriter *subwriter; /* Data output. */ }; -static struct casewriter_class scratch_writer_casewriter_class; +static const struct casewriter_class scratch_writer_casewriter_class; /* Opens FH, which must have referent type FH_REF_SCRATCH, and returns a scratch_writer for it, or a null pointer on @@ -143,7 +143,7 @@ scratch_writer_casewriter_destroy (struct casewriter *w UNUSED, void *writer_) free (writer); } -static struct casewriter_class scratch_writer_casewriter_class = +static const struct casewriter_class scratch_writer_casewriter_class = { scratch_writer_casewriter_write, scratch_writer_casewriter_destroy, diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index 18829430..8b29e0a5 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -88,7 +88,7 @@ struct sfm_reader size_t opcode_idx; /* Next opcode to interpret, 8 if none left. */ }; -static struct casereader_class sys_file_casereader_class; +static const struct casereader_class sys_file_casereader_class; static bool close_reader (struct sfm_reader *); @@ -1716,7 +1716,7 @@ skip_bytes (struct sfm_reader *r, size_t bytes) } } -static struct casereader_class sys_file_casereader_class = +static const struct casereader_class sys_file_casereader_class = { sys_file_casereader_read, sys_file_casereader_destroy, diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index fd663d69..c5392666 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -90,7 +90,7 @@ struct sfm_writer for long string variables. */ }; -static struct casewriter_class sys_file_casewriter_class; +static const struct casewriter_class sys_file_casewriter_class; static void write_header (struct sfm_writer *, const struct dictionary *); static void write_variable (struct sfm_writer *, const struct variable *); @@ -751,7 +751,7 @@ close_writer (struct sfm_writer *w) } /* System file writer casewriter class. */ -static struct casewriter_class sys_file_casewriter_class = +static const struct casewriter_class sys_file_casewriter_class = { sys_file_casewriter_write, sys_file_casewriter_destroy,