[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
style: move pkgdatadir to files.*
From: |
Akim Demaille |
Subject: |
style: move pkgdatadir to files.* |
Date: |
Sat, 16 Feb 2019 07:27:34 +0100 |
commit d7ec136ffb58f17084796d8b84d8f879e278ec55
Author: Akim Demaille <address@hidden>
Date: Thu Feb 14 05:46:25 2019 +0100
style: move pkgdatadir to files.*
Let's move it to a more logical place.
* src/output.h, src/output.c (pkgdatadir): Move to...
* src/files.h, src/files.c: here.
diff --git a/src/files.c b/src/files.c
index 8fa4c17e..688ea338 100644
--- a/src/files.c
+++ b/src/files.c
@@ -21,11 +21,13 @@
#include <config.h>
#include "system.h"
+#include <configmake.h> /* PKGDATADIR */
#include <error.h>
#include <dirname.h>
#include <get-errno.h>
#include <quote.h>
#include <quotearg.h>
+#include <relocatable.h> /* relocate2 */
#include <stdio-safer.h>
#include <xstrndup.h>
@@ -404,6 +406,21 @@ unlink_generated_sources (void)
unlink (generated_files[i].name);
}
+/* Memory allocated by relocate2, to free. */
+static char *relocate_buffer = NULL;
+
+char const *
+pkgdatadir (void)
+{
+ if (relocate_buffer)
+ return relocate_buffer;
+ else
+ {
+ char const *cp = getenv ("BISON_PKGDATADIR");
+ return cp ? cp : relocate2 (PKGDATADIR, &relocate_buffer);
+ }
+}
+
void
output_file_names_free (void)
{
@@ -417,4 +434,5 @@ output_file_names_free (void)
for (int i = 0; i < generated_files_size; i++)
free (generated_files[i].name);
free (generated_files);
+ free (relocate_buffer);
}
diff --git a/src/files.h b/src/files.h
index d5ee44c2..ca1be740 100644
--- a/src/files.h
+++ b/src/files.h
@@ -64,6 +64,9 @@ extern uniqstr current_file;
/* The computed base for output file names. */
extern char *all_but_ext;
+/* Where our data files are installed. */
+char const *pkgdatadir (void);
+
void compute_output_file_names (void);
void output_file_names_free (void);
diff --git a/src/output.c b/src/output.c
index b674f4ca..23612ba9 100644
--- a/src/output.c
+++ b/src/output.c
@@ -21,12 +21,10 @@
#include <config.h>
#include "system.h"
-#include <configmake.h>
#include <filename.h> /* IS_PATH_WITH_DIR */
#include <get-errno.h>
#include <path-join.h>
#include <quotearg.h>
-#include <relocatable.h> /* relocate2 */
#include <spawn-pipe.h>
#include <timevar.h>
#include <wait-process.h>
@@ -46,9 +44,6 @@
static struct obstack format_obstack;
-/* Memory allocated by relocate2, to free. */
-static char *relocate_buffer = NULL;
-
/*-------------------------------------------------------------------.
| Create a function NAME which associates to the muscle NAME the |
@@ -736,17 +731,4 @@ output (void)
unlink_generated_sources ();
obstack_free (&format_obstack, NULL);
- free (relocate_buffer);
-}
-
-char const *
-pkgdatadir (void)
-{
- if (relocate_buffer)
- return relocate_buffer;
- else
- {
- char const *cp = getenv ("BISON_PKGDATADIR");
- return cp ? cp : relocate2 (PKGDATADIR, &relocate_buffer);
- }
}
diff --git a/src/output.h b/src/output.h
index c308bf56..c8b88316 100644
--- a/src/output.h
+++ b/src/output.h
@@ -24,7 +24,4 @@
/* Output the parsing tables and the parser code to FTABLE. */
void output (void);
-/* Where our data files are installed. */
-char const *pkgdatadir (void);
-
#endif /* !OUTPUT_H_ */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- style: move pkgdatadir to files.*,
Akim Demaille <=