]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ddb/db_macro.c
xnu-1228.0.2.tar.gz
[apple/xnu.git] / osfmk / ddb / db_macro.c
index 6b13c690c4023283b9a1da4830cae04b92e2cbc4..9e9e6cf98a27e6cb04e03af6d515a9f7eec9f28d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -56,7 +56,7 @@
 /*
  */
 #include <kern/thread.h>
-#include <string.h>                    /* For strcmp(), strcpy() */
+#include <string.h>                    /* For strncmp(), strlcpy() */
 
 #include <machine/db_machdep.h>
 #include <ddb/db_command.h>
@@ -97,7 +97,7 @@ db_lookup_macro(char *name)
        for (mp = db_user_macro; mp < &db_user_macro[DB_NUSER_MACRO]; mp++) {
            if (mp->m_name[0] == 0)
                continue;
-           if (strcmp(mp->m_name, name) == 0)
+           if (strncmp(mp->m_name, name, TOK_STRING_SIZE) == 0)
                return(mp);
        }
        return(0);
@@ -125,7 +125,7 @@ db_def_macro_cmd(void)
                db_error("ddb: internal error(macro)\n");
                /* NOTREACHED */
            db_macro_free--;
-           strcpy(mp->m_name, db_tok_string);
+           strlcpy(mp->m_name, db_tok_string, TOK_STRING_SIZE);
        }
        for (c = db_read_char(); c == ' ' || c == '\t'; c = db_read_char());
        for (p = mp->m_lbuf; c > 0; c = db_read_char())
@@ -137,7 +137,7 @@ db_def_macro_cmd(void)
 void
 db_del_macro_cmd(void)
 {
-       register struct db_user_macro *mp;
+       struct db_user_macro *mp = NULL;
 
        if (db_read_token() != tIDENT 
            || (mp = db_lookup_macro(db_tok_string)) == 0) {
@@ -163,7 +163,7 @@ db_show_macro(void)
        for (mp = db_user_macro; mp < &db_user_macro[DB_NUSER_MACRO]; mp++) {
            if (mp->m_name[0] == 0)
                continue;
-           if (name && strcmp(mp->m_name, name))
+           if (name && strncmp(mp->m_name, name, TOK_STRING_SIZE))
                continue;
            db_printf("%s: %s", mp->m_name, mp->m_lbuf);
        }
@@ -195,11 +195,8 @@ db_exec_macro(char *name)
 }
 
 int
-db_arg_variable(
-       struct db_variable      *vp,
-       db_expr_t               *valuep,
-       int                     flag,
-       db_var_aux_param_t      ap)
+db_arg_variable(__unused struct db_variable *vp, db_expr_t *valuep, int flag,
+               db_var_aux_param_t ap)
 {
        db_expr_t value;
        char *name;