Browse files

pstore: Remove 'csv.h' and 'csv.c'

Signed-off-by: Jussi Virtanen <jussi.k.virtanen@gmail.com>
  • Loading branch information...
1 parent 0726b9d commit 2c7d8bcb28c93d66bffb51e0850a52930b147cef @jvirtanen jvirtanen committed Apr 29, 2012
Showing with 0 additions and 93 deletions.
  1. +0 −2 Makefile
  2. +0 −1 builtin-import.c
  3. +0 −47 csv.c
  4. +0 −10 include/pstore/csv.h
  5. +0 −1 pstore.c
  6. +0 −32 test/csv-test.c
View
2 Makefile
@@ -122,7 +122,6 @@ STATIC_LIB_FILE := libpstore.a
LIB_OBJS += buffer.o
LIB_OBJS += column.o
LIB_OBJS += compress.o
-LIB_OBJS += csv.o
LIB_OBJS += die.o
LIB_OBJS += extent.o
LIB_OBJS += fastlz/fastlz.o
@@ -145,7 +144,6 @@ TEST_RUNNER_C := test/test-runner.c
TEST_RUNNER_OBJ := test/test-runner.o
TEST_OBJS += harness.o
-TEST_OBJS += test/csv-test.o
ifneq ($(uname_S),Darwin)
TEST_OBJS += test/mmap-window-test.o
endif
View
1 builtin-import.c
@@ -9,7 +9,6 @@
#include "pstore/string.h"
#include "pstore/table.h"
#include "pstore/core.h"
-#include "pstore/csv.h"
#include "pstore/die.h"
#include "pstore/row.h"
#include "sheets/sheets.h"
View
47 csv.c
@@ -1,47 +0,0 @@
-#include "pstore/string.h"
-#include "pstore/compat.h"
-#include "pstore/csv.h"
-#include "pstore/die.h"
-
-#include <string.h>
-#include <ctype.h>
-
-static inline bool is_space_or_tab(char c)
-{
- return c == ' ' || c == '\t';
-}
-
-bool csv_field_value(char *s, unsigned long field_ndx, struct pstore_value *value)
-{
- unsigned long ndx;
- char *start, *end;
-
- start = s;
- for (ndx = 0; ndx < field_ndx; ndx++) {
- char *tmp;
-
- tmp = strchr(start, ',');
- if (!tmp)
- return false;
-
- start = tmp + 1;
- }
-
- while (is_space_or_tab(*start))
- start++;
-
- end = start;
- for (;;) {
- if (*end == '\0' || *end == '\n' || *end == ',')
- break;
- end++;
- }
-
- while (is_space_or_tab(*end))
- end--;
-
- value->s = start;
- value->len = end - start;
-
- return true;
-}
View
10 include/pstore/csv.h
@@ -1,10 +0,0 @@
-#ifndef PSTORE_CSV_H
-#define PSTORE_CSV_H
-
-#include "pstore/column.h"
-
-#include <stdbool.h>
-
-bool csv_field_value(char *record, unsigned long field_idx, struct pstore_value *value);
-
-#endif /* PSTORE_CSV_H */
View
1 pstore.c
@@ -1,7 +1,6 @@
#include "pstore/builtins.h"
#include "pstore/string.h"
#include "pstore/core.h"
-#include "pstore/csv.h"
#include <stdlib.h>
#include <string.h>
View
32 test/csv-test.c
@@ -1,32 +0,0 @@
-#include "pstore/test/harness.h"
-#include "pstore/csv.h"
-#include "test-suite.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-static char *line;
-
-void test_csv(void)
-{
- struct pstore_value value;
-
- line = strdup("hello\t,world\n");
-
- csv_field_value(line, 1, &value);
- assert_int_equals(5, value.len);
- assert_str_equals("world", value.s, value.len);
-
- free(line);
-}
-
-void test_csv_out_of_bounds(void)
-{
- struct pstore_value value;
-
- line = strdup("hello\t,world\n");
-
- assert_false(csv_field_value(line, 2, &value));
-
- free(line);
-}

0 comments on commit 2c7d8bc

Please sign in to comment.