mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 00:45:41 +02:00
Drop the C shim for float formatting now that jsonpull is C++
json_print_one() reached fpfmt through dtoa_shortest(), a C-linkage
wrapper in text.cpp that strdup()ed the formatted string so the C
jsonpull could take it and free() it. jsonpull has been C++ since 4f26211,
so it can append the std::string directly and skip the copy, the
allocation, and the free.
That was the shim's only caller, so fpfmt/fpfmt.h goes away with it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wJRAuhMninQE4wK2TUfuZ
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include <vector>
|
||||
#include "text.hpp"
|
||||
#include "fpfmt/fpfmt.hpp"
|
||||
#include "fpfmt/fpfmt.h"
|
||||
#include "errors.hpp"
|
||||
|
||||
/**
|
||||
@@ -176,17 +175,6 @@ std::string format_commandline(int argc, char **argv) {
|
||||
return out;
|
||||
}
|
||||
|
||||
// for jsonpull to call from C
|
||||
char *dtoa_shortest(double val) {
|
||||
std::string s = fpfmt::dtoa(val);
|
||||
char *dup = strdup(s.c_str());
|
||||
if (dup == NULL) {
|
||||
perror("strdup");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
||||
// to work with data from https://github.com/kmike/text-unidecode
|
||||
std::vector<std::string> read_unidecode(const char *fname) {
|
||||
std::string data;
|
||||
|
||||
Reference in New Issue
Block a user