[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] location: pass the location first
From: |
Akim Demaille |
Subject: |
[PATCH 2/3] location: pass the location first |
Date: |
Fri, 1 Feb 2013 14:28:18 +0100 |
* src/location.h, src/location.c (location_print): For consistency
with other data structures and other location_* routines, pass the
location argument first.
* src/complain.c: Adjust.
(location_caret): Likewise.
* src/parse-gram.y: Adjust.
---
src/complain.c | 4 ++--
src/location.c | 4 ++--
src/location.h | 4 ++--
src/parse-gram.y | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/complain.c b/src/complain.c
index c6e03d5..5a1b45a 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -89,7 +89,7 @@ error_message (const location *loc, warnings flags, const
char *prefix,
unsigned pos = 0;
if (loc)
- pos += location_print (stderr, *loc);
+ pos += location_print (*loc, stderr);
else
pos += fprintf (stderr, "%s", current_file ? current_file : program_name);
pos += fprintf (stderr, ": ");
@@ -117,7 +117,7 @@ error_message (const location *loc, warnings flags, const
char *prefix,
putc ('\n', stderr);
fflush (stderr);
if (loc && feature_flag & feature_caret && !(flags & no_caret))
- location_caret (stderr, *loc);
+ location_caret (*loc, stderr);
}
}
fflush (stderr);
diff --git a/src/location.c b/src/location.c
index d06f4fa..ecfa60e 100644
--- a/src/location.c
+++ b/src/location.c
@@ -99,7 +99,7 @@ location_compute (location *loc, boundary *cur, char const
*token, size_t size)
/* Output to OUT the location LOC.
Warning: it uses quotearg's slot 3. */
unsigned
-location_print (FILE *out, location loc)
+location_print (location loc, FILE *out)
{
unsigned res = 0;
int end_col = 0 != loc.end.column ? loc.end.column - 1 : 0;
@@ -161,7 +161,7 @@ cleanup_caret ()
}
void
-location_caret (FILE *out, location loc)
+location_caret (location loc, FILE *out)
{
/* FIXME: find a way to support multifile locations, and only open once each
file. That would make the procedure future-proof. */
diff --git a/src/location.h b/src/location.h
index f739652..2783f91 100644
--- a/src/location.h
+++ b/src/location.h
@@ -100,14 +100,14 @@ void location_compute (location *loc,
/* Print location to file. Return number of actually printed
characters. */
-unsigned location_print (FILE *out, location loc);
+unsigned location_print (location loc, FILE *out);
/* Free any allocated ressources and close any open file handles that are
left-over by the usage of location_caret. */
void cleanup_caret (void);
/* Output to OUT the line and caret corresponding to location LOC. */
-void location_caret (FILE *out, location loc);
+void location_caret (location loc, FILE *out);
/* Return -1, 0, 1, depending whether a is before, equal, or
after b. */
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 8a2a04e..0b42004 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -40,7 +40,7 @@
static YYLTYPE lloc_default (YYLTYPE const *, int);
#define YY_LOCATION_PRINT(File, Loc) \
- location_print (File, Loc)
+ location_print (Loc, File)
static void version_check (location const *loc, char const *version);
--
1.8.1.2