Information hiding.

This commit is contained in:
Eric S. Raymond 2017-07-03 17:21:06 -04:00
parent 4b51b06b73
commit 6e67222206
2 changed files with 2 additions and 4 deletions

View file

@ -189,8 +189,6 @@ struct command_t {
extern struct game_t game; extern struct game_t game;
extern struct settings_t settings; extern struct settings_t settings;
extern char* xstrdup(const char* s);
extern void* xmalloc(size_t size);
extern void packed_to_token(long, char token[]); extern void packed_to_token(long, char token[]);
extern long token_to_packed(const char token[]); extern long token_to_packed(const char token[]);
extern void tokenize(char*, struct command_t *); extern void tokenize(char*, struct command_t *);

4
misc.c
View file

@ -10,7 +10,7 @@
#include "advent.h" #include "advent.h"
#include "dungeon.h" #include "dungeon.h"
char* xstrdup(const char* s) static char* xstrdup(const char* s)
{ {
char* ptr = strdup(s); char* ptr = strdup(s);
if (ptr == NULL) { if (ptr == NULL) {
@ -22,7 +22,7 @@ char* xstrdup(const char* s)
return (ptr); return (ptr);
} }
void* xmalloc(size_t size) static void* xmalloc(size_t size)
{ {
void* ptr = malloc(size); void* ptr = malloc(size);
if (ptr == NULL) { if (ptr == NULL) {