PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ ShpLoaderDestroy()

void ShpLoaderDestroy ( SHPLOADERSTATE state)

Definition at line 1874 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().

1875 {
1876  /* Destroy a state object created with ShpLoaderOpenShape */
1877  int i;
1878 
1879  if (state != NULL)
1880  {
1881  if (state->hSHPHandle)
1882  SHPClose(state->hSHPHandle);
1883  if (state->hDBFHandle)
1884  DBFClose(state->hDBFHandle);
1885  if (state->field_names)
1886  {
1887  for (i = 0; i < state->num_fields; i++)
1888  free(state->field_names[i]);
1889 
1890  free(state->field_names);
1891  }
1892  if (state->pgfieldtypes)
1893  {
1894  for (i = 0; i < state->num_fields; i++)
1895  free(state->pgfieldtypes[i]);
1896 
1897  free(state->pgfieldtypes);
1898  }
1899  if (state->types)
1900  free(state->types);
1901  if (state->widths)
1902  free(state->widths);
1903  if (state->precisions)
1904  free(state->precisions);
1905  if (state->col_names)
1906  free(state->col_names);
1907 
1908  /* Free any column map fieldnames if specified */
1909  colmap_clean(&state->column_map);
1910 
1911  /* Free the state itself */
1912  free(state);
1913  }
1914 }
void colmap_clean(colmap *map)
Definition: shpcommon.c:167
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: