Changeset - r23539:bce8329ee42d
[Not reviewed]
master
0 21 0
Henry Wilson - 5 years ago 2019-03-04 20:49:33
m3henry@googlemail.com
Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector
21 files changed with 53 insertions and 55 deletions:
0 comments (0 inline, 0 general)
src/core/smallmap_type.hpp
Show inline comments
 
@@ -39,7 +39,7 @@ struct SmallPair {
 
 *
 
 * @see SmallVector
 
 */
 
template <typename T, typename U, uint S = 16>
 
template <typename T, typename U>
 
struct SmallMap : std::vector<SmallPair<T, U> > {
 
	typedef ::SmallPair<T, U> Pair;
 
	typedef Pair *iterator;
src/core/smallvec_type.hpp
Show inline comments
 
@@ -77,9 +77,8 @@ T* grow(std::vector<T>& vec, std::size_t
 
 *       inside the list.
 
 *
 
 * @param T The type of the items stored, must be a pointer
 
 * @param S The steps of allocation
 
 */
 
template <typename T, uint S>
 
template <typename T>
 
class AutoFreeSmallVector : public std::vector<T> {
 
public:
 
	~AutoFreeSmallVector()
 
@@ -108,9 +107,8 @@ public:
 
 *       inside the list.
 
 *
 
 * @param T The type of the items stored, must be a pointer
 
 * @param S The steps of allocation
 
 */
 
template <typename T, uint S>
 
template <typename T>
 
class AutoDeleteSmallVector : public std::vector<T> {
 
public:
 
	~AutoDeleteSmallVector()
 
@@ -131,6 +129,6 @@ public:
 
	}
 
};
 

	
 
typedef AutoFreeSmallVector<char*, 4> StringList; ///< Type for a list of strings.
 
typedef AutoFreeSmallVector<char*> StringList; ///< Type for a list of strings.
 

	
 
#endif /* SMALLVEC_TYPE_HPP */
src/game/game_text.hpp
Show inline comments
 
@@ -32,9 +32,9 @@ struct GameStrings {
 
	uint version;                  ///< The version of the language strings.
 
	LanguageStrings *cur_language; ///< The current (compiled) language.
 

	
 
	AutoDeleteSmallVector<LanguageStrings *, 4> raw_strings;      ///< The raw strings per language, first must be English/the master language!.
 
	AutoDeleteSmallVector<LanguageStrings *, 4> compiled_strings; ///< The compiled strings per language, first must be English/the master language!.
 
	StringList string_names;                                      ///< The names of the compiled strings.
 
	AutoDeleteSmallVector<LanguageStrings *> raw_strings;      ///< The raw strings per language, first must be English/the master language!.
 
	AutoDeleteSmallVector<LanguageStrings *> compiled_strings; ///< The compiled strings per language, first must be English/the master language!.
 
	StringList string_names;                                   ///< The names of the compiled strings.
 

	
 
	void Compile();
 
};
src/gfx_layout.cpp
Show inline comments
 
@@ -124,7 +124,7 @@ le_bool Font::getGlyphPoint(LEGlyphID gl
 
/**
 
 * Wrapper for doing layouts with ICU.
 
 */
 
class ICUParagraphLayout : public AutoDeleteSmallVector<ParagraphLayouter::Line *, 4>, public ParagraphLayouter {
 
class ICUParagraphLayout : public AutoDeleteSmallVector<ParagraphLayouter::Line *>, public ParagraphLayouter {
 
	icu::ParagraphLayout *p; ///< The actual ICU paragraph layout.
 
public:
 
	/** Visual run contains data about the bit of text with the same font. */
 
@@ -143,7 +143,7 @@ public:
 
	};
 

	
 
	/** A single line worth of VisualRuns. */
 
	class ICULine : public AutoDeleteSmallVector<ICUVisualRun *, 4>, public ParagraphLayouter::Line {
 
	class ICULine : public AutoDeleteSmallVector<ICUVisualRun *>, public ParagraphLayouter::Line {
 
		icu::ParagraphLayout::Line *l; ///< The actual ICU line.
 

	
 
	public:
 
@@ -269,7 +269,7 @@ public:
 
	};
 

	
 
	/** A single line worth of VisualRuns. */
 
	class FallbackLine : public AutoDeleteSmallVector<FallbackVisualRun *, 4>, public ParagraphLayouter::Line {
 
	class FallbackLine : public AutoDeleteSmallVector<FallbackVisualRun *>, public ParagraphLayouter::Line {
 
	public:
 
		int GetLeading() const;
 
		int GetWidth() const;
src/gfx_layout.h
Show inline comments
 
@@ -150,7 +150,7 @@ public:
 
 *
 
 * It also accounts for the memory allocations and frees.
 
 */
 
class Layouter : public AutoDeleteSmallVector<const ParagraphLayouter::Line *, 4> {
 
class Layouter : public AutoDeleteSmallVector<const ParagraphLayouter::Line *> {
 
	const char *string; ///< Pointer to the original string.
 

	
 
	/** Key into the linecache */
src/music/midifile.hpp
Show inline comments
 
@@ -22,8 +22,8 @@ struct MusicSongInfo;
 

	
 
struct MidiFile {
 
	struct DataBlock {
 
		uint32 ticktime;           ///< tick number since start of file this block should be triggered at
 
		uint32 realtime;           ///< real-time (microseconds) since start of file this block should be triggered at
 
		uint32 ticktime;        ///< tick number since start of file this block should be triggered at
 
		uint32 realtime;        ///< real-time (microseconds) since start of file this block should be triggered at
 
		std::vector<byte> data; ///< raw midi data contained in block
 
		DataBlock(uint32 _ticktime = 0) : ticktime(_ticktime) { }
 
	};
src/network/core/address.h
Show inline comments
 
@@ -19,7 +19,7 @@
 

	
 
class NetworkAddress;
 
typedef std::vector<NetworkAddress> NetworkAddressList; ///< Type for a list of addresses.
 
typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList;    ///< Type for a mapping between address and socket.
 
typedef SmallMap<NetworkAddress, SOCKET> SocketList;    ///< Type for a mapping between address and socket.
 

	
 
/**
 
 * Wrapper for (un)resolved network addresses; there's no reason to transform
src/network/network_client.cpp
Show inline comments
 
@@ -41,7 +41,7 @@
 
struct PacketReader : LoadFilter {
 
	static const size_t CHUNK = 32 * 1024;  ///< 32 KiB chunks of memory.
 

	
 
	AutoFreeSmallVector<byte *, 16> blocks; ///< Buffer with blocks of allocated memory.
 
	AutoFreeSmallVector<byte *> blocks;     ///< Buffer with blocks of allocated memory.
 
	byte *buf;                              ///< Buffer we're going to write to/read from.
 
	byte *bufe;                             ///< End of the buffer we write to/read from.
 
	byte **block;                           ///< The block we're reading from/writing to.
src/network/network_content.h
Show inline comments
 
@@ -67,11 +67,11 @@ struct ContentCallback {
 
class ClientNetworkContentSocketHandler : public NetworkContentSocketHandler, ContentCallback, HTTPCallback {
 
protected:
 
	typedef std::vector<ContentID> ContentIDList; ///< List of content IDs to (possibly) select.
 
	std::vector<ContentCallback *> callbacks; ///< Callbacks to notify "the world"
 
	ContentIDList requested;                     ///< ContentIDs we already requested (so we don't do it again)
 
	ContentVector infos;                         ///< All content info we received
 
	std::vector<char> http_response;       ///< The HTTP response to the requests we've been doing
 
	int http_response_index;                     ///< Where we are, in the response, with handling it
 
	std::vector<ContentCallback *> callbacks;     ///< Callbacks to notify "the world"
 
	ContentIDList requested;                      ///< ContentIDs we already requested (so we don't do it again)
 
	ContentVector infos;                          ///< All content info we received
 
	std::vector<char> http_response;              ///< The HTTP response to the requests we've been doing
 
	int http_response_index;                      ///< Where we are, in the response, with handling it
 

	
 
	FILE *curFile;        ///< Currently downloaded file
 
	ContentInfo *curInfo; ///< Information about the currently downloaded file
src/newgrf.h
Show inline comments
 
@@ -122,10 +122,10 @@ struct GRFFile : ZeroedMemoryAllocator {
 

	
 
	GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array.
 

	
 
	std::vector<CargoLabel> cargo_list;          ///< Cargo translation table (local ID -> label)
 
	std::vector<CargoLabel> cargo_list;             ///< Cargo translation table (local ID -> label)
 
	uint8 cargo_map[NUM_CARGO];                     ///< Inverse cargo translation table (CargoID -> local ID)
 

	
 
	std::vector<RailTypeLabel> railtype_list;    ///< Railtype translation table
 
	std::vector<RailTypeLabel> railtype_list;       ///< Railtype translation table
 
	RailTypeByte railtype_map[RAILTYPE_END];
 

	
 
	CanalProperties canal_local_properties[CF_END]; ///< Canal properties as set by this NewGRF
src/newgrf_config.h
Show inline comments
 
@@ -133,7 +133,7 @@ struct GRFParameterInfo {
 
	byte param_nr;         ///< GRF parameter to store content in
 
	byte first_bit;        ///< First bit to use in the GRF parameter
 
	byte num_bit;          ///< Number of bits to use for this parameter
 
	SmallMap<uint32, struct GRFText *, 8> value_names; ///< Names for each value.
 
	SmallMap<uint32, struct GRFText *> value_names; ///< Names for each value.
 
	bool complete_labels;  ///< True if all values have a label.
 

	
 
	uint32 GetValue(struct GRFConfig *config) const;
 
@@ -155,27 +155,27 @@ struct GRFConfig : ZeroedMemoryAllocator
 
	GRFConfig(const GRFConfig &config);
 
	~GRFConfig();
 

	
 
	GRFIdentifier ident;                           ///< grfid and md5sum to uniquely identify newgrfs
 
	uint8 original_md5sum[16];                     ///< MD5 checksum of original file if only a 'compatible' file was loaded
 
	char *filename;                                ///< Filename - either with or without full path
 
	GRFTextWrapper *name;                          ///< NOSAVE: GRF name (Action 0x08)
 
	GRFTextWrapper *info;                          ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
 
	GRFTextWrapper *url;                           ///< NOSAVE: URL belonging to this GRF.
 
	GRFError *error;                               ///< NOSAVE: Error/Warning during GRF loading (Action 0x0B)
 
	GRFIdentifier ident;                        ///< grfid and md5sum to uniquely identify newgrfs
 
	uint8 original_md5sum[16];                  ///< MD5 checksum of original file if only a 'compatible' file was loaded
 
	char *filename;                             ///< Filename - either with or without full path
 
	GRFTextWrapper *name;                       ///< NOSAVE: GRF name (Action 0x08)
 
	GRFTextWrapper *info;                       ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
 
	GRFTextWrapper *url;                        ///< NOSAVE: URL belonging to this GRF.
 
	GRFError *error;                            ///< NOSAVE: Error/Warning during GRF loading (Action 0x0B)
 

	
 
	uint32 version;                                ///< NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown
 
	uint32 min_loadable_version;                   ///< NOSAVE: Minimum compatible version a NewGRF can define
 
	uint8 flags;                                   ///< NOSAVE: GCF_Flags, bitset
 
	GRFStatus status;                              ///< NOSAVE: GRFStatus, enum
 
	uint32 grf_bugs;                               ///< NOSAVE: bugs in this GRF in this run, @see enum GRFBugs
 
	uint32 param[0x80];                            ///< GRF parameters
 
	uint8 num_params;                              ///< Number of used parameters
 
	uint8 num_valid_params;                        ///< NOSAVE: Number of valid parameters (action 0x14)
 
	uint8 palette;                                 ///< GRFPalette, bitset
 
	uint32 version;                             ///< NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown
 
	uint32 min_loadable_version;                ///< NOSAVE: Minimum compatible version a NewGRF can define
 
	uint8 flags;                                ///< NOSAVE: GCF_Flags, bitset
 
	GRFStatus status;                           ///< NOSAVE: GRFStatus, enum
 
	uint32 grf_bugs;                            ///< NOSAVE: bugs in this GRF in this run, @see enum GRFBugs
 
	uint32 param[0x80];                         ///< GRF parameters
 
	uint8 num_params;                           ///< Number of used parameters
 
	uint8 num_valid_params;                     ///< NOSAVE: Number of valid parameters (action 0x14)
 
	uint8 palette;                              ///< GRFPalette, bitset
 
	std::vector<GRFParameterInfo *> param_info; ///< NOSAVE: extra information about the parameters
 
	bool has_param_defaults;                       ///< NOSAVE: did this newgrf specify any defaults for it's parameters
 
	bool has_param_defaults;                    ///< NOSAVE: did this newgrf specify any defaults for it's parameters
 

	
 
	struct GRFConfig *next;                        ///< NOSAVE: Next item in the linked list
 
	struct GRFConfig *next;                     ///< NOSAVE: Next item in the linked list
 

	
 
	void CopyParams(const GRFConfig &src);
 

	
src/newgrf_debug.h
Show inline comments
 
@@ -29,7 +29,7 @@ struct NewGrfDebugSpritePicker {
 
	NewGrfDebugSpritePickerMode mode;   ///< Current state
 
	void *clicked_pixel;                ///< Clicked pixel (pointer to blitter buffer)
 
	uint32 click_time;                  ///< Realtime tick when clicked to detect next frame
 
	std::vector<SpriteID> sprites; ///< Sprites found
 
	std::vector<SpriteID> sprites;       ///< Sprites found
 
};
 

	
 
extern NewGrfDebugSpritePicker _newgrf_debug_sprite_picker;
src/newgrf_text.h
Show inline comments
 
@@ -59,7 +59,7 @@ struct LanguageMap {
 
	 * both cases. Thus we are basically implementing a multi-map. */
 
	std::vector<Mapping> gender_map; ///< Mapping of NewGRF and OpenTTD IDs for genders.
 
	std::vector<Mapping> case_map;   ///< Mapping of NewGRF and OpenTTD IDs for cases.
 
	int plural_form;                    ///< The plural form used for this language.
 
	int plural_form;                 ///< The plural form used for this language.
 

	
 
	int GetMapping(int newgrf_id, bool gender) const;
 
	int GetReverseMapping(int openttd_id, bool gender) const;
src/os/macosx/string_osx.cpp
Show inline comments
 
@@ -65,7 +65,7 @@ public:
 
	};
 

	
 
	/** A single line worth of VisualRuns. */
 
	class CoreTextLine : public AutoDeleteSmallVector<CoreTextVisualRun *, 4>, public ParagraphLayouter::Line {
 
	class CoreTextLine : public AutoDeleteSmallVector<CoreTextVisualRun *>, public ParagraphLayouter::Line {
 
	public:
 
		CoreTextLine(CTLineRef line, const FontMap &fontMapping, const CoreTextParagraphLayoutFactory::CharType *buff)
 
		{
src/os/windows/string_uniscribe.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ public:
 
	};
 

	
 
	/** A single line worth of VisualRuns. */
 
	class UniscribeLine : public AutoDeleteSmallVector<UniscribeVisualRun *, 4>, public ParagraphLayouter::Line {
 
	class UniscribeLine : public AutoDeleteSmallVector<UniscribeVisualRun *>, public ParagraphLayouter::Line {
 
	public:
 
		virtual int GetLeading() const;
 
		virtual int GetWidth() const;
src/saveload/saveload.cpp
Show inline comments
 
@@ -125,9 +125,9 @@ struct ReadBuffer {
 

	
 
/** Container for dumping the savegame (quickly) to memory. */
 
struct MemoryDumper {
 
	AutoFreeSmallVector<byte *, 16> blocks; ///< Buffer with blocks of allocated memory.
 
	byte *buf;                              ///< Buffer we're going to write to.
 
	byte *bufe;                             ///< End of the buffer we write to.
 
	AutoFreeSmallVector<byte *> blocks; ///< Buffer with blocks of allocated memory.
 
	byte *buf;                          ///< Buffer we're going to write to.
 
	byte *bufe;                         ///< End of the buffer we write to.
 

	
 
	/** Initialise our variables. */
 
	MemoryDumper() : buf(NULL), bufe(NULL)
src/settings_func.h
Show inline comments
 
@@ -30,7 +30,7 @@ void IniSaveWindowSettings(IniFile *ini,
 

	
 
/* Functions to load and save NewGRF settings to a separate
 
 * configuration file, used for presets. */
 
typedef AutoFreeSmallVector<char *, 4> GRFPresetList;
 
typedef AutoFreeSmallVector<char *> GRFPresetList;
 

	
 
void GetGRFPresetList(GRFPresetList *list);
 
struct GRFConfig *LoadGRFPresetFromConfig(const char *config_name);
src/stringfilter_type.h
Show inline comments
 
@@ -39,7 +39,7 @@ private:
 
	};
 

	
 
	const char *filter_buffer;                     ///< Parsed filter string. Words separated by 0.
 
	std::vector<WordState> word_index;          ///< Word index and filter state.
 
	std::vector<WordState> word_index;             ///< Word index and filter state.
 
	uint word_matches;                             ///< Summary of filter state: Number of words matched.
 

	
 
	const bool *case_sensitive;                    ///< Match case-sensitively (usually a static variable).
src/town_cmd.cpp
Show inline comments
 
@@ -3457,7 +3457,7 @@ Town *ClosestTownFromTile(TileIndex tile
 
}
 

	
 
static bool _town_rating_test = false; ///< If \c true, town rating is in test-mode.
 
static SmallMap<const Town *, int, 4> _town_test_ratings; ///< Map of towns to modified ratings, while in town rating test-mode.
 
static SmallMap<const Town *, int> _town_test_ratings; ///< Map of towns to modified ratings, while in town rating test-mode.
 

	
 
/**
 
 * Switch the town rating to test-mode, to allow commands to be tested without affecting current ratings.
src/vehicle.cpp
Show inline comments
 
@@ -688,7 +688,7 @@ void ResetVehicleColourMap()
 
 * List of vehicles that should check for autoreplace this tick.
 
 * Mapping of vehicle -> leave depot immediately after autoreplace.
 
 */
 
typedef SmallMap<Vehicle *, bool, 4> AutoreplaceMap;
 
typedef SmallMap<Vehicle *, bool> AutoreplaceMap;
 
static AutoreplaceMap _vehicles_to_autoreplace;
 

	
 
void InitializeVehicles()
src/widgets/dropdown_type.h
Show inline comments
 
@@ -98,7 +98,7 @@ public:
 
/**
 
 * A drop down list is a collection of drop down list items.
 
 */
 
typedef AutoDeleteSmallVector<const DropDownListItem *, 4> DropDownList;
 
typedef AutoDeleteSmallVector<const DropDownListItem *> DropDownList;
 

	
 
void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width = false, bool instant_close = false);
 

	
0 comments (0 inline, 0 general)