PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_summary()

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

Definition at line 87 of file lwgeom_debug.c.

88 {
89  size_t size = 128;
90  char *result;
91  char *tmp;
92  uint32_t 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 * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
void lwfree(void *mem)
Definition: lwutil.c:244
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
void * lwalloc(size_t size)
Definition: lwutil.c:229
static char * lwgeom_flagchars(LWGEOM *lwg)
Definition: lwgeom_debug.c:36
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
Definition: lwgeom_debug.c:158
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t type
Definition: liblwgeom.h:506
LWGEOM ** geoms
Definition: liblwgeom.h:512
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_summary().

Here is the call graph for this function:
Here is the caller graph for this function: