PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ShpLoaderDestroy()

void ShpLoaderDestroy ( SHPLOADERSTATE state)

Definition at line 1872 of file shp2pgsql-core.c.

References shp_loader_state::col_names, colmap_clean(), shp_loader_state::column_map, DBFClose(), shp_loader_state::field_names, free(), shp_loader_state::hDBFHandle, shp_loader_state::hSHPHandle, shp_loader_state::num_fields, shp_loader_state::pgfieldtypes, shp_loader_state::precisions, SHPClose(), shp_loader_state::types, and shp_loader_state::widths.

Referenced by main(), pgui_action_import(), test_ShpLoaderDestroy(), and validate_remote_loader_columns().

1873 {
1874  /* Destroy a state object created with ShpLoaderOpenShape */
1875  int i;
1876 
1877  if (state != NULL)
1878  {
1879  if (state->hSHPHandle)
1880  SHPClose(state->hSHPHandle);
1881  if (state->hDBFHandle)
1882  DBFClose(state->hDBFHandle);
1883  if (state->field_names)
1884  {
1885  for (i = 0; i < state->num_fields; i++)
1886  free(state->field_names[i]);
1887 
1888  free(state->field_names);
1889  }
1890  if (state->pgfieldtypes)
1891  {
1892  for (i = 0; i < state->num_fields; i++)
1893  free(state->pgfieldtypes[i]);
1894 
1895  free(state->pgfieldtypes);
1896  }
1897  if (state->types)
1898  free(state->types);
1899  if (state->widths)
1900  free(state->widths);
1901  if (state->precisions)
1902  free(state->precisions);
1903  if (state->col_names)
1904  free(state->col_names);
1905 
1906  /* Free any column map fieldnames if specified */
1907  colmap_clean(&state->column_map);
1908 
1909  /* Free the state itself */
1910  free(state);
1911  }
1912 }
void colmap_clean(colmap *map)
Definition: shpcommon.c:87
DBFFieldType * types
DBFHandle hDBFHandle
SHPHandle hSHPHandle
void SHPAPI_CALL DBFClose(DBFHandle psDBF)
Definition: dbfopen.c:578
void free(void *)
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
Definition: shpopen.c:759
Here is the call graph for this function:
Here is the caller graph for this function: