// File_Extractor 1.0.0. http://www.slack.net/~ant/12#include "blargg_common.h"34/* Copyright (C) 2008-2009 Shay Green. This module is free software; you5can redistribute it and/or modify it under the terms of the GNU Lesser6General Public License as published by the Free Software Foundation; either7version 2.1 of the License, or (at your option) any later version. This8module is distributed in the hope that it will be useful, but WITHOUT ANY9WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS10FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more11details. You should have received a copy of the GNU Lesser General Public12License along with this module; if not, write to the Free Software Foundation,13Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */1415#include "blargg_source.h"1617void blargg_vector_::init()18{19begin_ = NULL;20size_ = 0;21}2223void blargg_vector_::clear()24{25void* p = begin_;26begin_ = NULL;27size_ = 0;28free( p );29}3031blargg_err_t blargg_vector_::resize_( size_t n, size_t elem_size )32{33if ( n != size_ )34{35if ( n == 0 )36{37// Simpler to handle explicitly. Realloc will handle a size of 0,38// but then we have to avoid raising an error for a NULL return.39clear();40}41else42{43void* p = realloc( begin_, n * elem_size );44CHECK_ALLOC( p );45begin_ = p;46size_ = n;47}48}49return blargg_ok;50}515253