summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-11-21 23:48:39 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-21 15:54:10 -0800
commit907a22f37e3acd6c12b2299ad331c3ea81d56f24 (patch)
tree5a3cf9f3ecbaffdf9fe0385aba751169039121dd /file.c
parent8e60f3bb44fba8bd4a815ef2abcc5c584d96c464 (diff)
downloadsubsurface-907a22f37e3acd6c12b2299ad331c3ea81d56f24.tar.gz
Simplify params numbering in parse_csv_file
When we add more fields, we don't need to renumber the whole thing. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/file.c b/file.c
index 45b153d25..db9a10e2e 100644
--- a/file.c
+++ b/file.c
@@ -330,6 +330,7 @@ void parse_file(const char *filename, char **error)
void parse_csv_file(const char *filename, int timef, int depthf, int tempf, char **error)
{
struct memblock mem;
+ int pnr=0;
char *params[11];
char timebuf[MAXCOLDIGITS];
char depthbuf[MAXCOLDIGITS];
@@ -357,17 +358,17 @@ void parse_csv_file(const char *filename, int timef, int depthf, int tempf, char
* is not discarded during the transform, thus prepend time with 1 */
strftime(curtime, sizeof(curtime), "1%H%M", timep);
- params[0] = "timeField";
- params[1] = timebuf;
- params[2] = "depthField";
- params[3] = depthbuf;
- params[4] = "tempField";
- params[5] = tempbuf;
- params[6] = "date";
- params[7] = curdate;
- params[8] = "time";
- params[9] = curtime;
- params[10] = NULL;
+ params[pnr++] = "timeField";
+ params[pnr++] = timebuf;
+ params[pnr++] = "depthField";
+ params[pnr++] = depthbuf;
+ params[pnr++] = "tempField";
+ params[pnr++] = tempbuf;
+ params[pnr++] = "date";
+ params[pnr++] = curdate;
+ params[pnr++] = "time";
+ params[pnr++] = curtime;
+ params[pnr++] = NULL;
if (filename == NULL)
return;