Angband
Typedefs | Functions
z-quark.h File Reference

Save memory by storing strings in a global array, ensuring that each is only allocated once. More...

#include "h-basic.h"

Go to the source code of this file.

Typedefs

typedef size_t quark_t
 Quark type.

Functions

quark_t quark_add (const char *str)
 Return a quark for the string 'str'.
const char * quark_str (quark_t q)
 Return the string corresponding to the quark.
void quarks_init (void)
 Initialise the quarks package.
void quarks_free (void)
 De-initialise the quarks package.

Detailed Description

Save memory by storing strings in a global array, ensuring that each is only allocated once.

Copyright (c) 1997 Ben Harrison Copyright (c) 2007 "Elly"

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Typedef Documentation

typedef size_t quark_t

Quark type.

Function Documentation

quark_t quark_add ( const char *  str)
const char* quark_str ( quark_t  q)
void quarks_free ( void  )

De-initialise the quarks package.

References i, mem_free(), nr_quarks, quarks, and string_free().

Referenced by teardown_tests().

void quarks_init ( void  )

Initialise the quarks package.

References alloc_quarks, mem_zalloc(), quarks, and QUARKS_INIT.

Referenced by setup_tests().