C++ bindings needed to use system_allocator's free() too
This commit is contained in:
parent
6bffacefaf
commit
759fbe77e5
2 changed files with 7 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#define HAMMER_HAMMER__HPP
|
#define HAMMER_HAMMER__HPP
|
||||||
|
|
||||||
#include "../../../hammer.h"
|
#include "../../../hammer.h"
|
||||||
|
#include "../../../internal.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
|
@ -49,7 +50,7 @@ namespace hammer {
|
||||||
std::string asUnambiguous() {
|
std::string asUnambiguous() {
|
||||||
char* buf = h_write_result_unamb(token);
|
char* buf = h_write_result_unamb(token);
|
||||||
std::string s = std::string(buf);
|
std::string s = std::string(buf);
|
||||||
free(buf);
|
(&system_allocator)->free(&system_allocator, buf);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "hammer.h"
|
#include "hammer.h"
|
||||||
|
|
||||||
|
/* "Internal" in this case means "we're not ready to commit
|
||||||
|
* to a public API." Many structures and routines here will be
|
||||||
|
* useful in client programs.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define assert_message(check, message) do { } while(0)
|
#define assert_message(check, message) do { } while(0)
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue