[segyio] 248/376: Implement line_indices with field_forall
Jørgen Kvalsvik
jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:40 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 ab86222f73a0c7038ed52d1c01399074cad1bfdc
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date: Mon Mar 27 12:38:56 2017 +0200
Implement line_indices with field_forall
Turns out the line_indices function was an early version of the
field_forall function, so it might as well be an alias for it. It reads
less from every trace, so it should be faster in most cases.
---
lib/src/segy.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/lib/src/segy.c b/lib/src/segy.c
index 1979819..b57bd31 100644
--- a/lib/src/segy.c
+++ b/lib/src/segy.c
@@ -963,20 +963,14 @@ static int segy_line_indices( segy_file* fp,
int* buf,
long trace0,
int trace_bsize ) {
-
- if( field_size[ field ] == 0 )
- return SEGY_INVALID_FIELD;
-
- char header[ SEGY_TRACE_HEADER_SIZE ];
- for( ; num_indices--; traceno += stride, ++buf ) {
-
- int err = segy_traceheader( fp, traceno, header, trace0, trace_bsize );
- if( err != 0 ) return SEGY_FREAD_ERROR;
-
- segy_get_field( header, field, buf );
- }
-
- return SEGY_OK;
+ return segy_field_forall( fp,
+ field,
+ traceno, /* start */
+ traceno + (num_indices * stride), /* stop */
+ stride, /* step */
+ buf,
+ trace0,
+ trace_bsize );
}
static int count_lines( segy_file* fp,
--
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