File tree Expand file tree Collapse file tree 3 files changed +7
-15
lines changed
Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,12 @@ public enum Geohash {
4646 if length < 1 , length > 22 {
4747 assertionFailure ( " length must be greater than 0 and less than 23 " )
4848 }
49- return string ( from: GEOHASH_encode ( coordinate. latitude, coordinate. longitude, length) )
49+ guard let pointer = GEOHASH_encode ( coordinate. latitude, coordinate. longitude, length) else {
50+ fatalError ( )
51+ }
52+ let hash = string ( from: pointer)
53+ free ( pointer)
54+ return hash
5055 }
5156
5257 public static func adjacent( hash: String , direction: Direction ) -> String {
@@ -57,7 +62,7 @@ public enum Geohash {
5762 fatalError ( )
5863 }
5964 let adjacent = string ( from: pointer)
60- GEOHASH_free_adjacent ( pointer)
65+ free ( pointer)
6166 return adjacent
6267 }
6368
Original file line number Diff line number Diff line change @@ -23,10 +23,7 @@ typedef struct {
2323} GEOHASH_neighbors ;
2424
2525char * GEOHASH_encode (double latitude , double longitude , unsigned int hash_length );
26- void GEOHASH_free_encode (char * hash );
27-
2826GEOHASH_neighbors * GEOHASH_get_neighbors (const char * hash );
2927void GEOHASH_free_neighbors (GEOHASH_neighbors * neighbors );
3028
3129char * GEOHASH_get_adjacent (const char * hash , GEOHASH_direction dir );
32- void GEOHASH_free_adjacent (char * hash );
Original file line number Diff line number Diff line change 8383 return hash;
8484}
8585
86- void
87- GEOHASH_free_encode (char * hash) {
88- free (hash);
89- }
90-
9186GEOHASH_neighbors*
9287GEOHASH_get_neighbors (const char * hash)
9388{
166161 base[len] = BASE32_ENCODE_TABLE[idx];
167162 return base;
168163}
169-
170- void
171- GEOHASH_free_adjacent (char * hash) {
172- free (hash);
173- }
You can’t perform that action at this time.
0 commit comments