mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
move RUNTIME_ARRAY into it's own header
This commit is contained in:
parent
5dd770d7ea
commit
964d054117
@ -15,6 +15,8 @@
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
|
||||
#if (defined __MINGW32__) || (defined _MSC_VER)
|
||||
@ -121,30 +123,5 @@ allocate(JNIEnv* e, unsigned size)
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
|
||||
template <class T>
|
||||
class RuntimeArray {
|
||||
public:
|
||||
RuntimeArray(unsigned size):
|
||||
body(static_cast<T*>(malloc(size * sizeof(T))))
|
||||
{ }
|
||||
|
||||
~RuntimeArray() {
|
||||
free(body);
|
||||
}
|
||||
|
||||
T* body;
|
||||
};
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) RuntimeArray<type> name(size);
|
||||
# define RUNTIME_ARRAY_BODY(name) name.body
|
||||
|
||||
#else // not _MSC_VER
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) type name[size];
|
||||
# define RUNTIME_ARRAY_BODY(name) name
|
||||
|
||||
#endif // not _MSC_VER
|
||||
|
||||
#endif//JNI_UTIL
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "processor.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "classpath-common.h"
|
||||
#include "process.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include "tokenizer.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
namespace vm {
|
||||
|
||||
object
|
||||
|
20
src/common.h
20
src/common.h
@ -226,23 +226,6 @@ alias(void* p, unsigned offset)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
template <class T>
|
||||
class RuntimeArray {
|
||||
public:
|
||||
RuntimeArray(unsigned size):
|
||||
body(static_cast<T*>(malloc(size * sizeof(T))))
|
||||
{ }
|
||||
|
||||
~RuntimeArray() {
|
||||
free(body);
|
||||
}
|
||||
|
||||
T* body;
|
||||
};
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) RuntimeArray<type> name(size);
|
||||
# define RUNTIME_ARRAY_BODY(name) name.body
|
||||
|
||||
inline int
|
||||
vsnprintf(char* dst, size_t size, const char* format, va_list a)
|
||||
{
|
||||
@ -272,9 +255,6 @@ fopen(const char* name, const char* mode)
|
||||
|
||||
#else // not _MSC_VER
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) type name[size];
|
||||
# define RUNTIME_ARRAY_BODY(name) name
|
||||
|
||||
inline int
|
||||
vsnprintf(char* dst, size_t size, const char* format, va_list a)
|
||||
{
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "compiler.h"
|
||||
#include "arch.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
extern "C" uint64_t
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "assembler.h"
|
||||
#include "target.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "finder.h"
|
||||
#include "lzma.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "processor.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "arch.h"
|
||||
#include "lzma.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
24
src/main.cpp
24
src/main.cpp
@ -16,6 +16,8 @@
|
||||
#include "system.h"
|
||||
#include "finder.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
#if (defined __MINGW32__) || (defined _MSC_VER)
|
||||
# define PATH_SEPARATOR ';'
|
||||
#else
|
||||
@ -29,28 +31,6 @@
|
||||
# define and &&
|
||||
# define xor ^
|
||||
|
||||
template <class T>
|
||||
class RuntimeArray {
|
||||
public:
|
||||
RuntimeArray(unsigned size):
|
||||
body(static_cast<T*>(malloc(size * sizeof(T))))
|
||||
{ }
|
||||
|
||||
~RuntimeArray() {
|
||||
free(body);
|
||||
}
|
||||
|
||||
T* body;
|
||||
};
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) RuntimeArray<type> name(size);
|
||||
# define RUNTIME_ARRAY_BODY(name) name.body
|
||||
|
||||
#else // not _MSC_VER
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) type name[size];
|
||||
# define RUNTIME_ARRAY_BODY(name) name
|
||||
|
||||
#endif // not _MSC_VER
|
||||
|
||||
#ifdef BOOT_LIBRARY
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "process.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
using namespace vm;
|
||||
|
||||
namespace {
|
||||
|
40
src/util/runtime-array.h
Normal file
40
src/util/runtime-array.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (c) 2008-2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#ifndef UTIL_RUNTIME_ARRAY_H
|
||||
#define UTIL_RUNTIME_ARRAY_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
template <class T>
|
||||
class RuntimeArray {
|
||||
public:
|
||||
RuntimeArray(unsigned size):
|
||||
body(static_cast<T*>(malloc(size * sizeof(T))))
|
||||
{ }
|
||||
|
||||
~RuntimeArray() {
|
||||
free(body);
|
||||
}
|
||||
|
||||
T* body;
|
||||
};
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) RuntimeArray<type> name(size);
|
||||
# define RUNTIME_ARRAY_BODY(name) name.body
|
||||
|
||||
#else // not _MSC_VER
|
||||
|
||||
# define RUNTIME_ARRAY(type, name, size) type name[size];
|
||||
# define RUNTIME_ARRAY_BODY(name) name
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -13,6 +13,8 @@
|
||||
#include "target.h"
|
||||
#include "vector.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
#define CAST_BRANCH(x) reinterpret_cast<BranchOperationType>(x)
|
||||
|
Loading…
Reference in New Issue
Block a user