[GRASS5] #include _GRASS_GIS_LIB_

Hi,

in include/display.h we have:

#ifndef _GRASS_GIS_LIB_
#include <grass/gis.h>
#endif
#ifndef _GRASS_DISPLAY_LIB_
#define _GRASS_DISPLAY_LIB_

in include/segment.h we have:

#ifndef _GRASS_GIS_LIB
#include <grass/gis.h>
#endif

(note no trailing "_" in _GRASS_GIS_LIB)

are any of these even used?

should
#include <grass/gis.h>

just be included without a test?

?
Hamish

Hamish wrote:

in include/display.h we have:

#ifndef _GRASS_GIS_LIB_
#include <grass/gis.h>
#endif
#ifndef _GRASS_DISPLAY_LIB_
#define _GRASS_DISPLAY_LIB_

in include/segment.h we have:

#ifndef _GRASS_GIS_LIB
#include <grass/gis.h>
#endif

(note no trailing "_" in _GRASS_GIS_LIB)

are any of these even used?

AFAICT, no. Certainly, gis.h doesn't define either of those macros.

should
#include <grass/gis.h>

just be included without a test?

Yes.

Header files should protect themselves against repeated inclusion,
e.g.

  #ifndef GRASS_GIS_H
  #define GRASS_GIS_H

  <rest of header file>

  #endif /* GRASS_GIS_H */

This is already done for the most important headers, including gis.h.

--
Glynn Clements <glynn@gclements.plus.com>

> in include/display.h we have:
>
> #ifndef _GRASS_GIS_LIB_
> #include <grass/gis.h>
> #endif
> #ifndef _GRASS_DISPLAY_LIB_
> #define _GRASS_DISPLAY_LIB_
>
>
> in include/segment.h we have:
>
> #ifndef _GRASS_GIS_LIB
> #include <grass/gis.h>
> #endif
>
> (note no trailing "_" in _GRASS_GIS_LIB)
>
>
> are any of these even used?

AFAICT, no. Certainly, gis.h doesn't define either of those macros.

> should
> #include <grass/gis.h>
>
> just be included without a test?

Yes.

Header files should protect themselves against repeated inclusion,
e.g.

  #ifndef GRASS_GIS_H
  #define GRASS_GIS_H

  <rest of header file>

  #endif /* GRASS_GIS_H */

This is already done for the most important headers, including gis.h.

display.h, segment.h updated in CVS.

Hamish