Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/rogue Kill some pointer indirections. Don't use variab...



details:   https://anonhg.NetBSD.org/src/rev/f2429bc4418c
branches:  trunk
changeset: 765288:f2429bc4418c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon May 23 23:01:17 2011 +0000

description:
Kill some pointer indirections. Don't use variables as format strings.

diffstat:

 games/rogue/move.c     |  8 ++++----
 games/rogue/pack.c     |  6 +++---
 games/rogue/rogue.h    |  6 +++---
 games/rogue/spec_hit.c |  6 +++---
 games/rogue/throw.c    |  6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

diffs (144 lines):

diff -r 0d425dd04fbb -r f2429bc4418c games/rogue/move.c
--- a/games/rogue/move.c        Mon May 23 22:59:27 2011 +0000
+++ b/games/rogue/move.c        Mon May 23 23:01:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: move.c,v 1.12 2009/08/12 08:44:45 dholland Exp $       */
+/*     $NetBSD: move.c,v 1.13 2011/05/23 23:01:17 joerg Exp $  */
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)move.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: move.c,v 1.12 2009/08/12 08:44:45 dholland Exp $");
+__RCSID("$NetBSD: move.c,v 1.13 2011/05/23 23:01:17 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -57,7 +57,7 @@
 
 short m_moves = 0;
 boolean jump = 0;
-const char *you_can_move_again = "you can move again";
+const char you_can_move_again[] = "you can move again";
 
 static boolean can_turn(short, short);
 static boolean check_hunger(boolean);
@@ -405,7 +405,7 @@
                                        mv_mons();
                                }
                        }
-                       messagef(1, you_can_move_again);
+                       messagef(1, "%s", you_can_move_again);
                }
        }
        if (msg_only) {
diff -r 0d425dd04fbb -r f2429bc4418c games/rogue/pack.c
--- a/games/rogue/pack.c        Mon May 23 22:59:27 2011 +0000
+++ b/games/rogue/pack.c        Mon May 23 23:01:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pack.c,v 1.11 2009/08/12 08:44:45 dholland Exp $       */
+/*     $NetBSD: pack.c,v 1.12 2011/05/23 23:01:17 joerg Exp $  */
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)pack.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: pack.c,v 1.11 2009/08/12 08:44:45 dholland Exp $");
+__RCSID("$NetBSD: pack.c,v 1.12 2011/05/23 23:01:17 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -55,7 +55,7 @@
 
 #include "rogue.h"
 
-const char *curse_message = "you can't, it appears to be cursed";
+const char curse_message[] = "you can't, it appears to be cursed";
 
 static object *check_duplicate(object *, object *);
 static boolean is_pack_letter(short *, unsigned short *);
diff -r 0d425dd04fbb -r f2429bc4418c games/rogue/rogue.h
--- a/games/rogue/rogue.h       Mon May 23 22:59:27 2011 +0000
+++ b/games/rogue/rogue.h       Mon May 23 23:01:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rogue.h,v 1.20 2009/08/12 08:44:45 dholland Exp $      */
+/*     $NetBSD: rogue.h,v 1.21 2011/05/23 23:01:17 joerg Exp $ */
 
 /*
  * Copyright (c) 1988, 1993
@@ -667,7 +667,7 @@
 extern char    hunger_str[HUNGER_STR_LEN];
 extern char    login_name[MAX_OPT_LEN];
 extern const char   *byebye_string;
-extern const char   *curse_message;
+extern const char   curse_message[];
 extern const char   *error_file;
 extern char   *fruit;
 extern const char   *const m_names[];
@@ -676,7 +676,7 @@
 extern char   *nick_name;
 extern const char   *press_space;
 extern char   *save_file;
-extern const char   *you_can_move_again;
+extern const char   you_can_move_again[];
 extern const long      level_points[];
 extern short   add_strength;
 extern short   auto_search;
diff -r 0d425dd04fbb -r f2429bc4418c games/rogue/spec_hit.c
--- a/games/rogue/spec_hit.c    Mon May 23 22:59:27 2011 +0000
+++ b/games/rogue/spec_hit.c    Mon May 23 23:01:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_hit.c,v 1.8 2008/01/14 03:50:02 dholland Exp $    */
+/*     $NetBSD: spec_hit.c,v 1.9 2011/05/23 23:01:17 joerg Exp $       */
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: spec_hit.c,v 1.8 2008/01/14 03:50:02 dholland Exp $");
+__RCSID("$NetBSD: spec_hit.c,v 1.9 2011/05/23 23:01:17 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@
                        }
                        killed_by(NULL, HYPOTHERMIA);
                }
-               messagef(1, you_can_move_again);
+               messagef(1, "%s", you_can_move_again);
                monster->m_flags &= (~FREEZING_ROGUE);
        }
 }
diff -r 0d425dd04fbb -r f2429bc4418c games/rogue/throw.c
--- a/games/rogue/throw.c       Mon May 23 22:59:27 2011 +0000
+++ b/games/rogue/throw.c       Mon May 23 23:01:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: throw.c,v 1.11 2009/08/12 08:44:45 dholland Exp $      */
+/*     $NetBSD: throw.c,v 1.12 2011/05/23 23:01:17 joerg Exp $ */
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)throw.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: throw.c,v 1.11 2009/08/12 08:44:45 dholland Exp $");
+__RCSID("$NetBSD: throw.c,v 1.12 2011/05/23 23:01:17 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -89,7 +89,7 @@
                return;
        }
        if ((weapon->in_use_flags & BEING_USED) && weapon->is_cursed) {
-               messagef(0, curse_message);
+               messagef(0, "%s", curse_message);
                return;
        }
        row = rogue.row; col = rogue.col;



Home | Main Index | Thread Index | Old Index