[segyio] 53/376: Private header file for internal functions.
Jørgen Kvalsvik
jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
jokva-guest pushed a commit to branch debian
in repository segyio.
commit e92d0bdf907323083a068184328fb27383c4dbb2
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date: Wed Oct 19 13:54:40 2016 +0200
Private header file for internal functions.
These functions are exposed to the linker in order to be testable, but
they're private to the implementation and not exported in the public
header when installed.
---
src/segyio/segy.c | 3 ++-
src/segyio/util.h | 17 +++++++++++++++++
tests/test_segy.c | 8 +-------
tests/test_utils.c | 7 +------
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/segyio/segy.c b/src/segyio/segy.c
index 52f6c5d..4d93078 100644
--- a/src/segyio/segy.c
+++ b/src/segyio/segy.c
@@ -10,7 +10,8 @@
#include <stdlib.h>
#include <string.h>
-#include "segy.h"
+#include <segyio/segy.h>
+#include <segyio/util.h>
static unsigned char a2e[256] = {
0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15,
diff --git a/src/segyio/util.h b/src/segyio/util.h
new file mode 100644
index 0000000..6292e85
--- /dev/null
+++ b/src/segyio/util.h
@@ -0,0 +1,17 @@
+#ifndef SEGYIO_UTILS_H
+#define SEGYIO_UTILS_H
+
+#include <stdio.h>
+
+/*
+ * Functions that are internal implementations detail, but exposed to the
+ * testing utilities. These functions won't show up in the installed headers.
+ */
+
+void ebcdic2ascii( const char* ebcdic, char* ascii );
+void ascii2ebcdic( const char* ascii, char* ebcdic );
+void ibm2ieee(void* to, const void* from, int len);
+void ieee2ibm(void* to, const void* from, int len);
+int segy_seek( FILE*, unsigned int, long, unsigned int );
+
+#endif //SEGYIO_UTILS_H
diff --git a/tests/test_segy.c b/tests/test_segy.c
index ee30999..d508914 100644
--- a/tests/test_segy.c
+++ b/tests/test_segy.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <segyio/segy.h>
+#include <segyio/util.h>
#include "unittest.h"
@@ -559,13 +560,6 @@ void test_error_codes_sans_file() {
"Expected sorting to be invalid." );
}
-
-/*
- * segy_seek is private to the implementation, but we need external linkage for
- * this test.
- */
-int segy_seek( FILE*, unsigned int, long, unsigned int );
-
void test_file_size_above_4GB(){
FILE* fp = tmpfile();
diff --git a/tests/test_utils.c b/tests/test_utils.c
index e74947c..c82ad48 100644
--- a/tests/test_utils.c
+++ b/tests/test_utils.c
@@ -1,11 +1,9 @@
#include <stdlib.h>
#include <string.h>
#include <segyio/segy.h>
+#include <segyio/util.h>
#include "unittest.h"
-void ebcdic2ascii( const char*, char* );
-void ascii2ebcdic( const char*, char* );
-
void testEbcdicConversion() {
char expected[] = "Hello there!";
char str[] = "\xc8\x85\x93\x93\x96\x40\xa3\x88\x85\x99\x85\x4f";
@@ -52,9 +50,6 @@ void testConversionAllocation() {
#define MAX 1000000 /* number of iterations */
#define IBM_EPS 4.7683738e-7 /* worst case error */
-void ibm2ieee(void* to, const void* from, int len);
-void ieee2ibm(void* to, const void* from, int len);
-
static void check(float f1, double * epsm) {
int exp;
float f2;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git
More information about the debian-science-commits
mailing list