forked from bblanchon/ArduinoJson
Reduced size by 52 bytes by inlining createNode()
This commit is contained in:
@ -6,9 +6,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ListIterator.hpp"
|
||||
#include "ListConstIterator.hpp"
|
||||
#include "../JsonBuffer.hpp"
|
||||
#include "ListConstIterator.hpp"
|
||||
#include "ListIterator.hpp"
|
||||
#include "PlacementNew.hpp"
|
||||
|
||||
namespace ArduinoJson {
|
||||
namespace Internals {
|
||||
@ -48,7 +49,12 @@ class List {
|
||||
const_iterator end() const { return const_iterator(NULL); }
|
||||
|
||||
protected:
|
||||
node_type *createNode();
|
||||
node_type *createNode() {
|
||||
if (!_buffer) return NULL;
|
||||
void *ptr = _buffer->alloc(sizeof(node_type));
|
||||
return ptr ? new (ptr) node_type() : NULL;
|
||||
}
|
||||
|
||||
void addNode(node_type *node);
|
||||
void removeNode(node_type *nodeToRemove);
|
||||
|
||||
|
@ -20,13 +20,6 @@ int List<T>::size() const {
|
||||
return nodeCount;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename List<T>::node_type *List<T>::createNode() {
|
||||
if (!_buffer) return NULL;
|
||||
void *ptr = _buffer->alloc(sizeof(node_type));
|
||||
return ptr ? new (ptr) node_type() : NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void List<T>::addNode(node_type *nodeToAdd) {
|
||||
if (_firstNode) {
|
||||
|
Reference in New Issue
Block a user