PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_summary()

static char* lwcollection_summary ( LWCOLLECTION col,
int  offset 
)
static

Definition at line 87 of file lwgeom_debug.c.

References lwalloc(), LWDEBUG, LWDEBUGF, lwfree(), lwgeom_flagchars(), lwgeom_summary(), lwrealloc(), lwtype_name(), and LWGEOM::type.

Referenced by lwgeom_summary().

88 {
89  size_t size = 128;
90  char *result;
91  char *tmp;
92  int i;
93  static char *nl = "\n";
94  char *pad="";
95  char *zmflags = lwgeom_flagchars((LWGEOM*)col);
96 
97  LWDEBUG(2, "lwcollection_summary called");
98 
99  result = (char *)lwalloc(size);
100 
101  sprintf(result, "%*.s%s[%s] with %d elements\n",
102  offset, pad, lwtype_name(col->type),
103  zmflags,
104  col->ngeoms);
105 
106  for (i=0; i<col->ngeoms; i++)
107  {
108  tmp = lwgeom_summary(col->geoms[i], offset+2);
109  size += strlen(tmp)+1;
110  result = lwrealloc(result, size);
111 
112  LWDEBUGF(4, "Reallocated %d bytes for result", size);
113  if ( i > 0 ) strcat(result,nl);
114 
115  strcat(result, tmp);
116  lwfree(tmp);
117  }
118 
119  LWDEBUG(3, "lwcollection_summary returning");
120 
121  return result;
122 }
void lwfree(void *mem)
Definition: lwutil.c:244
uint8_t type
Definition: liblwgeom.h:503
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
Definition: lwgeom_debug.c:158
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static char * lwgeom_flagchars(LWGEOM *lwg)
Definition: lwgeom_debug.c:36
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
LWGEOM ** geoms
Definition: liblwgeom.h:509
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function:
Here is the caller graph for this function: