GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
segment/seek.c File Reference

Segment seek routines. More...

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <grass/gis.h>
#include "local_proto.h"
Include dependency graph for segment/seek.c:

Go to the source code of this file.

Macros

#define SEG_SEEK_FAST(SEG, n, index)   ((((off_t) (n)) << (SEG)->sizebits) + (index) + (SEG)->offset)
 Internal use only. More...
 
#define SEG_SEEK_SLOW(SEG, n, index)   ((off_t) (n) * (SEG)->size + (index) + (SEG)->offset)
 

Functions

int seg_seek_fast (const SEGMENT *SEG, int n, int index)
 
int seg_seek_slow (const SEGMENT *SEG, int n, int index)
 
int seg_seek (const SEGMENT *SEG, int n, int index)
 

Detailed Description

Segment seek routines.

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
GRASS GIS Development Team
Date
2005-2009

Definition in file segment/seek.c.

Macro Definition Documentation

◆ SEG_SEEK_FAST

#define SEG_SEEK_FAST (   SEG,
  n,
  index 
)    ((((off_t) (n)) << (SEG)->sizebits) + (index) + (SEG)->offset)

Internal use only.

Seek into a segment.

Parameters
[in,out]SEGsegment
[in]n
[in]index
Returns
0 on success
-1 if unable to seek

Definition at line 36 of file segment/seek.c.

Referenced by seg_seek_fast().

◆ SEG_SEEK_SLOW

#define SEG_SEEK_SLOW (   SEG,
  n,
  index 
)    ((off_t) (n) * (SEG)->size + (index) + (SEG)->offset)

Definition at line 39 of file segment/seek.c.

Referenced by seg_seek_slow().

Function Documentation

◆ seg_seek()

int seg_seek ( const SEGMENT SEG,
int  n,
int  index 
)

Definition at line 62 of file segment/seek.c.

References SEGMENT::seek.

◆ seg_seek_fast()

int seg_seek_fast ( const SEGMENT SEG,
int  n,
int  index 
)

Definition at line 42 of file segment/seek.c.

References G_fatal_error(), and SEG_SEEK_FAST.

Referenced by seg_setup().

◆ seg_seek_slow()

int seg_seek_slow ( const SEGMENT SEG,
int  n,
int  index 
)

Definition at line 52 of file segment/seek.c.

References G_fatal_error(), and SEG_SEEK_SLOW.

Referenced by seg_setup().