PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ ShpLoaderDestroy()

void ShpLoaderDestroy ( SHPLOADERSTATE state)

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

1884 {
1885  /* Destroy a state object created with ShpLoaderOpenShape */
1886  int i;
1887  if (state != NULL)
1888  {
1889  if (state->hSHPHandle)
1890  SHPClose(state->hSHPHandle);
1891  if (state->hDBFHandle)
1892  DBFClose(state->hDBFHandle);
1893  if (state->field_names)
1894  {
1895  for (i = 0; i < state->num_fields; i++)
1896  free(state->field_names[i]);
1897 
1898  free(state->field_names);
1899  }
1900  if (state->pgfieldtypes)
1901  {
1902  for (i = 0; i < state->num_fields; i++)
1903  free(state->pgfieldtypes[i]);
1904 
1905  free(state->pgfieldtypes);
1906  }
1907  if (state->types)
1908  free(state->types);
1909  if (state->widths)
1910  free(state->widths);
1911  if (state->precisions)
1912  free(state->precisions);
1913  if (state->col_names)
1914  free(state->col_names);
1915 
1916  /* Free any column map fieldnames if specified */
1917  colmap_clean(&state->column_map);
1918 
1919  /* Free the state itself */
1920  free(state);
1921  }
1922 }
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: