mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 17:05:41 +02:00
- geojson.cpp and attribute.cpp passed key_pool::pool() and set_attribute_accum() a c_str() from a std::string, forcing a needless reconstruction (and truncating at an embedded NUL). Both overloads take std::string, so pass it directly. The geojson.cpp one is the hottest loop in the program. - Replace the hand-maintained counters beside range-for loops in attribute.cpp, main.cpp and tile-join.cpp with indexed loops, since the index is only wanted for error messages. - parse_json_args took json_pull_ptr by value and then copied it, costing two refcount bumps per construction. Move it. - Assert that the parser is still attached where geojson.cpp reads geometry->parser->line. Only json_read results reach it today, but json_read_tree and json_disconnect now clear every parser pointer, so a detached tree would null-deref there instead of tripping an assert. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KNxyHKasyWrWcvre2yK4r
31 lines
730 B
C++
31 lines
730 B
C++
#ifndef GEOJSON_HPP
|
|
#define GEOJSON_HPP
|
|
|
|
#include <stdio.h>
|
|
#include <set>
|
|
#include <map>
|
|
#include <string>
|
|
#include "mbtiles.hpp"
|
|
#include "jsonpull/jsonpull.h"
|
|
#include "serial.hpp"
|
|
|
|
struct parse_json_args {
|
|
json_pull_ptr jp;
|
|
int layer;
|
|
std::string *layername;
|
|
|
|
struct serialization_state *sst;
|
|
|
|
parse_json_args(json_pull_ptr jp1, int layer1, std::string *layername1, struct serialization_state *sst1)
|
|
: jp(std::move(jp1)), layer(layer1), layername(layername1), sst(sst1) {
|
|
}
|
|
};
|
|
|
|
json_pull_ptr json_begin_map(char *map, long long len);
|
|
void json_end_map(json_pull_ptr &jp);
|
|
|
|
void parse_json(struct serialization_state *sst, json_pull_ptr &jp, int layer, std::string layername);
|
|
void *run_parse_json(void *v);
|
|
|
|
#endif
|