aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2016-01-18 15:24:18 -0500
committerFranklin Wei <git@fwei.tk>2016-01-18 15:24:18 -0500
commit526f472c822fe567b3b50814b1321a8f7a24c945 (patch)
tree9956b92b1a1e0776d25f71e5d1c89adb8d4b586a /src
parent344a56010938c28225c3d145d5191c8fb8234288 (diff)
downloadnetcosm-526f472c822fe567b3b50814b1321a8f7a24c945.zip
netcosm-526f472c822fe567b3b50814b1321a8f7a24c945.tar.gz
netcosm-526f472c822fe567b3b50814b1321a8f7a24c945.tar.bz2
netcosm-526f472c822fe567b3b50814b1321a8f7a24c945.tar.xz
remove sig_debugf as it's no longer needed
Diffstat (limited to 'src')
-rw-r--r--src/auth.c4
-rw-r--r--src/client.c2
-rw-r--r--src/globals.h4
-rw-r--r--src/room.c8
-rw-r--r--src/server.c4
-rw-r--r--src/server_reqs.c14
-rw-r--r--src/userdb.c2
7 files changed, 18 insertions, 20 deletions
diff --git a/src/auth.c b/src/auth.c
index 4198302..42af3ed 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -195,7 +195,7 @@ struct userdata_t *auth_check(const char *name2, const char *pass2)
if(data)
{
- sig_debugf("auth module: user %s found\n", name2);
+ debugf("auth module: user %s found\n", name2);
char *new_hash_hex = hash_pass_hex(pass, salt);
/* hashes are in HEX to avoid the Trucha bug */
@@ -212,7 +212,7 @@ struct userdata_t *auth_check(const char *name2, const char *pass2)
}
}
- sig_debugf("auth failure for user %s\n", name2);
+ debugf("auth failure for user %s\n", name2);
memset(pass, 0, strlen(pass));
free(pass);
diff --git a/src/client.c b/src/client.c
index 3d77ddf..2ad7256 100644
--- a/src/client.c
+++ b/src/client.c
@@ -324,7 +324,7 @@ bool poll_requests(void)
request_complete = 1;
return true;
default:
- sig_debugf("WARNING: client process received unknown code %d\n", cmd);
+ debugf("WARNING: client process received unknown code %d\n", cmd);
break;
}
}
diff --git a/src/globals.h b/src/globals.h
index 1eed1d4..66088ed 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -84,8 +84,6 @@
#define MSG_MAX PIPE_BUF
#ifndef NDEBUG
#define debugf(fmt,...) debugf_real(__func__, __LINE__, __FILE__, fmt, ##__VA_ARGS__)
-#define sig_debugf debugf
#else
-#define debugf(fmt,...)
-#define sig_debugf debugf
+#define debugf(fmt,...) /* nop */
#endif
diff --git a/src/room.c b/src/room.c
index 0b49e14..e0be4fd 100644
--- a/src/room.c
+++ b/src/room.c
@@ -223,7 +223,7 @@ static SIMP_EQUAL(enum direction_t, dir_equal);
/* loads room data (supplied by the world module) into our internal format */
void world_init(const struct roomdata_t *data, size_t sz, const char *name)
{
- printf("Loading world with %lu rooms.\n", sz);
+ debugf("Loading world with %lu rooms.\n", sz);
world = calloc(sz, sizeof(struct room_t));
world_sz = 0;
world_name = strdup(name);
@@ -239,10 +239,10 @@ void world_init(const struct roomdata_t *data, size_t sz, const char *name)
//world[i].uniq_id = strdup(world[i].uniq_id);
world[i].data.name = strdup(world[i].data.name);
world[i].data.desc = strdup(world[i].data.desc);
- printf("Loading room '%s'\n", world[i].data.uniq_id);
+ debugf("Loading room '%s'\n", world[i].data.uniq_id);
if(hash_insert(map, world[i].data.uniq_id, world + i))
- error("Duplicate room ID '%s'\n", world[i].data.uniq_id);
+ error("Duplicate room ID '%s'", world[i].data.uniq_id);
for(int dir = 0; dir < NUM_DIRECTIONS; ++dir)
{
@@ -314,7 +314,7 @@ void world_init(const struct roomdata_t *data, size_t sz, const char *name)
enum direction_t *opp = hash_lookup(dir_map, &j);
struct room_t *adj = room_get(world[i].adjacent[j]);
if(adj->adjacent[*opp] != i)
- printf("WARNING: Rooms '%s' and '%s' are one-way\n",
+ debugf("WARNING: Rooms '%s' and '%s' are one-way\n",
world[i].data.uniq_id, adj->data.uniq_id);
}
}
diff --git a/src/server.c b/src/server.c
index 94cb709..ef82b57 100644
--- a/src/server.c
+++ b/src/server.c
@@ -76,7 +76,7 @@ static void handle_disconnects(void)
pid_t pid;
while((pid = waitpid(-1, NULL, WNOHANG)) > 0)
{
- sig_debugf("Client disconnect.\n");
+ debugf("Client disconnect.\n");
//struct child_data *child = hash_lookup(child_map, &pid);
--num_clients;
@@ -103,7 +103,7 @@ static void handle_client(int fd, struct sockaddr_in *addr,
static void __attribute__((noreturn)) serv_cleanup(void)
{
- sig_debugf("Shutdown server.\n");
+ debugf("Shutdown server.\n");
/* kill all our children (usually init claims them and wait()'s
for them, but not always) */
diff --git a/src/server_reqs.c b/src/server_reqs.c
index 6a63d1e..c7e9f09 100644
--- a/src/server_reqs.c
+++ b/src/server_reqs.c
@@ -156,7 +156,7 @@ static void req_move_room(unsigned char *data, size_t datalen, struct child_data
room_user_del(sender->room, sender);
/* TODO: checking */
- sig_debugf("Moving in direction %d\n", dir);
+ debugf("Moving in direction %d\n", dir);
room_id new = current->adjacent[dir];
int status = 0;
if(new != ROOM_NONE)
@@ -164,7 +164,7 @@ static void req_move_room(unsigned char *data, size_t datalen, struct child_data
child_set_room(sender, new);
status = 1;
}
- sig_debugf("server status: %d\n", status);
+ debugf("server status: %d\n", status);
send_packet(sender, REQ_MOVE, &status, sizeof(status));
}
@@ -181,11 +181,11 @@ static void req_send_user(unsigned char *data, size_t datalen, struct child_data
return;
}
- sig_debugf("looking up user %s failed\n", data);
- sig_debugf("failure 2\n");
+ debugf("looking up user %s failed\n", data);
+ debugf("failure 2\n");
}
- sig_debugf("failure 1\n");
+ debugf("failure 1\n");
}
static void req_del_user(unsigned char *data, size_t datalen, struct child_data *sender)
@@ -300,7 +300,7 @@ bool handle_child_req(int in_fd)
if(!sender)
{
- sig_debugf("WARNING: got data from unknown PID, ignoring.\n");
+ debugf("WARNING: got data from unknown PID, ignoring.\n");
goto fail;
}
@@ -313,7 +313,7 @@ bool handle_child_req(int in_fd)
if(!req)
{
- sig_debugf("Unknown request.\n");
+ debugf("Unknown request.\n");
goto fail;
}
diff --git a/src/userdb.c b/src/userdb.c
index 32e43b8..abcdb51 100644
--- a/src/userdb.c
+++ b/src/userdb.c
@@ -157,7 +157,7 @@ struct userdata_t *userdb_request_lookup(const char *name)
if(are_child)
{
send_master(REQ_GETUSERDATA, name, strlen(name) + 1);
- sig_debugf("returned reqdata is of type %d\n", reqdata_type);
+ debugf("returned reqdata is of type %d\n", reqdata_type);
if(reqdata_type == TYPE_USERDATA)
return &returned_reqdata.userdata;
return NULL;