From de8345d35743652032f575d4b1afb6d2a5d2781f Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Tue, 12 Nov 2013 14:12:33 +0100 Subject: kern: remove register qualifiers * kern/strings.c: Remove register qualifiers. --- kern/strings.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'kern/strings.c') diff --git a/kern/strings.c b/kern/strings.c index 3676f98e..07527226 100644 --- a/kern/strings.c +++ b/kern/strings.c @@ -55,10 +55,10 @@ int strcmp( - register const char *s1, - register const char *s2) + const char *s1, + const char *s2) { - register unsigned int a, b; + unsigned int a, b; do { a = *s1++; @@ -82,11 +82,11 @@ strcmp( int strncmp( - register const char *s1, - register const char *s2, + const char *s1, + const char *s2, size_t n) { - register unsigned int a, b; + unsigned int a, b; while (n != 0) { a = *s1++; @@ -113,10 +113,10 @@ strncmp( char * strcpy( - register char *to, - register const char *from) + char *to, + const char *from) { - register char *ret = to; + char *ret = to; while ((*to++ = *from++) != '\0') continue; @@ -135,11 +135,11 @@ strcpy( char * strncpy( - register char *to, - register const char *from, - register size_t count) + char *to, + const char *from, + size_t count) { - register char *ret = to; + char *ret = to; while (count != 0) { count--; @@ -163,9 +163,9 @@ strncpy( size_t strlen( - register const char *string) + const char *string) { - register const char *ret = string; + const char *ret = string; while (*string++ != '\0') continue; -- cgit v1.2.3 From 2b33e316ac0d14b564ade0dd6fc3be136e945926 Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Thu, 19 Dec 2013 18:51:05 +0100 Subject: kern/strings.c (strlen): mark with attribute pure * kern/strings.c (strlen): Mark with attribute pure. --- kern/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kern/strings.c') diff --git a/kern/strings.c b/kern/strings.c index 07527226..72eb4f3b 100644 --- a/kern/strings.c +++ b/kern/strings.c @@ -161,7 +161,7 @@ strncpy( * the terminating null character. */ -size_t +size_t __attribute__ ((pure)) strlen( const char *string) { -- cgit v1.2.3 From be1ce42e936c96776b661ba5a93b0c9d0d76bb31 Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Fri, 20 Dec 2013 13:29:00 +0100 Subject: Mark pure functions with attribute pure --- ddb/db_aout.c | 4 ++-- ddb/db_break.c | 4 ++-- ddb/db_break.h | 2 +- ddb/db_command.c | 2 +- ddb/db_command.h | 2 +- ddb/db_output.c | 2 +- ddb/db_output.h | 2 +- ddb/db_run.c | 2 +- ddb/db_sym.c | 2 +- device/dev_name.c | 2 +- include/string.h | 8 ++++---- kern/strings.c | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) (limited to 'kern/strings.c') diff --git a/ddb/db_aout.c b/ddb/db_aout.c index 57c680a1..87ba9753 100644 --- a/ddb/db_aout.c +++ b/ddb/db_aout.c @@ -132,7 +132,7 @@ aout_db_sym_init(symtab, esymtab, name, task_addr) /* * check file name or not (check xxxx.x pattern) */ -private boolean_t +private boolean_t __attribute__ ((pure)) aout_db_is_filename(name) const char *name; { @@ -149,7 +149,7 @@ aout_db_is_filename(name) /* * special name comparison routine with a name in the symbol table entry */ -private boolean_t +private boolean_t __attribute__ ((pure)) aout_db_eq_name(sp, name) const struct nlist *sp; const char *name; diff --git a/ddb/db_break.c b/ddb/db_break.c index e41834da..0534f686 100644 --- a/ddb/db_break.c +++ b/ddb/db_break.c @@ -154,7 +154,7 @@ db_delete_thread_breakpoint(bkpt, task_thd) } } -static db_thread_breakpoint_t +static db_thread_breakpoint_t __attribute__ ((pure)) db_find_thread_breakpoint(bkpt, thread) const db_breakpoint_t bkpt; const thread_t thread; @@ -350,7 +350,7 @@ db_delete_breakpoint(task, addr, task_thd) } } -db_breakpoint_t +db_breakpoint_t __attribute__ ((pure)) db_find_breakpoint(task, addr) const task_t task; db_addr_t addr; diff --git a/ddb/db_break.h b/ddb/db_break.h index 2dfa8040..610af2f8 100644 --- a/ddb/db_break.h +++ b/ddb/db_break.h @@ -71,7 +71,7 @@ struct db_breakpoint { typedef struct db_breakpoint *db_breakpoint_t; -extern db_breakpoint_t db_find_breakpoint( const task_t task, db_addr_t addr); +extern db_breakpoint_t db_find_breakpoint( const task_t task, db_addr_t addr) __attribute__ ((pure)); extern boolean_t db_find_breakpoint_here( const task_t task, db_addr_t addr); extern void db_set_breakpoints(void); extern void db_clear_breakpoints(void); diff --git a/ddb/db_command.c b/ddb/db_command.c index 3257e073..3879ec5c 100644 --- a/ddb/db_command.c +++ b/ddb/db_command.c @@ -522,7 +522,7 @@ db_fncall(void) db_printf(" %#N\n", retval); } -boolean_t +boolean_t __attribute__ ((pure)) db_option(modif, option) const char *modif; int option; diff --git a/ddb/db_command.h b/ddb/db_command.h index 634dd9d1..4208bda8 100644 --- a/ddb/db_command.h +++ b/ddb/db_command.h @@ -41,7 +41,7 @@ #include extern void db_command_loop(void); -extern boolean_t db_option(const char *, int); +extern boolean_t db_option(const char *, int) __attribute__ ((pure)); extern void db_error(const char *) __attribute__ ((noreturn)); /* report error */ diff --git a/ddb/db_output.c b/ddb/db_output.c index f7561d24..f2829cc4 100644 --- a/ddb/db_output.c +++ b/ddb/db_output.c @@ -188,7 +188,7 @@ db_id_putc(char c, vm_offset_t dummy) /* * Return output position */ -int +int __attribute__ ((pure)) db_print_position(void) { return (db_output_position); diff --git a/ddb/db_output.h b/ddb/db_output.h index e8866474..497ae430 100644 --- a/ddb/db_output.h +++ b/ddb/db_output.h @@ -36,7 +36,7 @@ #define _DDB_DB_OUTPUT_H_ extern void db_force_whitespace(void); -extern int db_print_position(void); +extern int db_print_position(void) __attribute__ ((pure)); extern void db_end_line(void); extern void db_printf(const char *fmt, ...); /* alternate name */ diff --git a/ddb/db_run.c b/ddb/db_run.c index 945d097a..6e409ff3 100644 --- a/ddb/db_run.c +++ b/ddb/db_run.c @@ -249,7 +249,7 @@ db_single_step(regs, task) db_breakpoint_t db_not_taken_bkpt = 0; db_breakpoint_t db_taken_bkpt = 0; -db_breakpoint_t +db_breakpoint_t __attribute__ ((pure)) db_find_temp_breakpoint(task, addr) const task_t task; db_addr_t addr; diff --git a/ddb/db_sym.c b/ddb/db_sym.c index bbf14bdb..beb4d18e 100644 --- a/ddb/db_sym.c +++ b/ddb/db_sym.c @@ -88,7 +88,7 @@ db_add_symbol_table(type, start, end, name, ref, map_pointer) * Note: return value points to static data whose content is * overwritten by each call... but in practice this seems okay. */ -static char * +static char * __attribute__ ((pure)) db_qualify(symname, symtabname) const char *symname; const char *symtabname; diff --git a/device/dev_name.c b/device/dev_name.c index 49d96aa7..4cc046ab 100644 --- a/device/dev_name.c +++ b/device/dev_name.c @@ -63,7 +63,7 @@ nomap(void) * src and target are equal in first 'len' characters * next character of target is 0 (end of string). */ -boolean_t +boolean_t __attribute__ ((pure)) name_equal(src, len, target) const char *src; int len; diff --git a/include/string.h b/include/string.h index c77d387b..c31b4292 100644 --- a/include/string.h +++ b/include/string.h @@ -32,7 +32,7 @@ extern void *memcpy (void *dest, const void *src, size_t n); extern void *memmove (void *dest, const void *src, size_t n); -extern int memcmp (const void *s1, const void *s2, size_t n); +extern int memcmp (const void *s1, const void *s2, size_t n) __attribute__ ((pure)); extern void *memset (void *s, int c, size_t n); @@ -46,11 +46,11 @@ extern char *strrchr (const char *s, int c); extern char *strsep (char **strp, const char *delim); -extern int strcmp (const char *s1, const char *s2); +extern int strcmp (const char *s1, const char *s2) __attribute__ ((pure)); -extern int strncmp (const char *s1, const char *s2, size_t n); +extern int strncmp (const char *s1, const char *s2, size_t n) __attribute__ ((pure)); -extern size_t strlen (const char *s); +extern size_t strlen (const char *s) __attribute__ ((pure)); extern char *strstr(const char *haystack, const char *needle); diff --git a/kern/strings.c b/kern/strings.c index 72eb4f3b..c77ae4fe 100644 --- a/kern/strings.c +++ b/kern/strings.c @@ -53,7 +53,7 @@ * contents are identical upto the length of s1. */ -int +int __attribute__ ((pure)) strcmp( const char *s1, const char *s2) @@ -80,7 +80,7 @@ strcmp( * comparison runs for at most "n" characters. */ -int +int __attribute__ ((pure)) strncmp( const char *s1, const char *s2, -- cgit v1.2.3 From b5365a3c2cdaa507c0af3edd30d9d597083606bc Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 2 Jan 2015 16:02:52 +0100 Subject: kern: Fix typos in comments (found by codespell) Signed-off-by: Stefan Weil --- kern/ipc_kobject.c | 2 +- kern/ipc_mig.c | 2 +- kern/mach_clock.c | 2 +- kern/profile.c | 2 +- kern/sched_prim.c | 2 +- kern/strings.c | 4 ++-- kern/xpr.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'kern/strings.c') diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c index bf22028e..709ec9ec 100644 --- a/kern/ipc_kobject.c +++ b/kern/ipc_kobject.c @@ -244,7 +244,7 @@ ipc_kobject_server(request) } else { /* * The message contents of the request are intact. - * Destroy everthing except the reply port right, + * Destroy everything except the reply port right, * which is needed in the reply message. */ diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c index 41ebc94e..cc61ec76 100644 --- a/kern/ipc_mig.c +++ b/kern/ipc_mig.c @@ -612,7 +612,7 @@ kern_return_t thread_set_state_KERNEL( * knows to fall back on an RPC. For other return values, it won't * retry with an RPC. The retry might get a different (incorrect) rc. * Return values are only set (and should only be set, with copyout) - * on successfull calls. + * on successful calls. */ kern_return_t diff --git a/kern/mach_clock.c b/kern/mach_clock.c index 0a7458b0..b627b89d 100644 --- a/kern/mach_clock.c +++ b/kern/mach_clock.c @@ -234,7 +234,7 @@ void clock_interrupt( update_mapped_time(&time); /* - * Schedule soft-interupt for timeout if needed + * Schedule soft-interrupt for timeout if needed */ if (needsoft) { if (basepri) { diff --git a/kern/profile.c b/kern/profile.c index e14d4116..55107218 100644 --- a/kern/profile.c +++ b/kern/profile.c @@ -194,7 +194,7 @@ thread_t th; * Make a request to the profile_thread by inserting * the buffer in the send queue, and wake it up. * The last buffer must be inserted at the head of the - * send queue, so the profile_thread handles it immediatly. + * send queue, so the profile_thread handles it immediately. */ if (kmem_alloc( kernel_map, &vm_buf_entry, sizeof(struct buf_to_send)) != KERN_SUCCESS) diff --git a/kern/sched_prim.c b/kern/sched_prim.c index 89fb1dc8..376217a8 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -155,7 +155,7 @@ void sched_init(void) min_quantum = hz / 10; /* context switch 10 times/second */ wait_queue_init(); - pset_sys_bootstrap(); /* initialize processer mgmt. */ + pset_sys_bootstrap(); /* initialize processor mgmt. */ queue_init(&action_queue); simple_lock_init(&action_lock); sched_tick = 0; diff --git a/kern/strings.c b/kern/strings.c index c77ae4fe..e299534a 100644 --- a/kern/strings.c +++ b/kern/strings.c @@ -50,7 +50,7 @@ * the contents are identical up to the length of s2. * It returns < 0 if the first differing character is smaller * in s1 than in s2 or if s1 is shorter than s2 and the - * contents are identical upto the length of s1. + * contents are identical up to the length of s1. */ int __attribute__ ((pure)) @@ -157,7 +157,7 @@ strncpy( /* * Abstract: - * strlen returns the number of characters in "string" preceeding + * strlen returns the number of characters in "string" preceding * the terminating null character. */ diff --git a/kern/xpr.h b/kern/xpr.h index 4a06216a..72f68170 100644 --- a/kern/xpr.h +++ b/kern/xpr.h @@ -34,7 +34,7 @@ * which will expand into the following code: * if (xprflags & XPR_SYSCALLS) * xpr("syscall: %d, 0x%x\n", syscallno, arg1); - * Xpr will log the pointer to the printf string and up to 6 arguements, + * Xpr will log the pointer to the printf string and up to 6 arguments, * along with a timestamp and cpuinfo (for multi-processor systems), into * a circular buffer. The actual printf processing is delayed until after * the buffer has been collected. It is assumed that the text/data segments -- cgit v1.2.3