mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +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:
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "jsonpull.h"
|
||||
#include "../fpfmt/fpfmt.h"
|
||||
#include "../fpfmt/fpfmt.hpp"
|
||||
|
||||
#define BUFFER 10000
|
||||
|
||||
@@ -803,9 +803,7 @@ static void json_print_one(std::string &val, const json_object *o) {
|
||||
snprintf(s, sizeof(s), "%llu", o->large_unsigned());
|
||||
val.append(s);
|
||||
} else {
|
||||
char *s = dtoa_shortest(o->number());
|
||||
val.append(s);
|
||||
free(s);
|
||||
val.append(fpfmt::dtoa(o->number()));
|
||||
}
|
||||
} else if (o->type == JSON_NULL) {
|
||||
val.append("null");
|
||||
|
||||
Reference in New Issue
Block a user