src/helper: wrap and clean headers.
authorZachary T Welch <zw@superlucidity.net>
Mon, 9 Nov 2009 10:47:00 +0000 (02:47 -0800)
committerZachary T Welch <zw@superlucidity.net>
Mon, 9 Nov 2009 17:44:33 +0000 (09:44 -0800)
Remove all useless 'extern' keywords from function prototypes.
Wraps long lines for readability.

src/helper/binarybuffer.h
src/helper/command.h
src/helper/configuration.h
src/helper/fileio.h
src/helper/log.h
src/helper/replacements.h

index eef4057ab17cb419262209c69f9b5a899812b4d7..5017a358819110fadb85f7eb04be4941b5ed7a0d 100644 (file)
@@ -30,7 +30,8 @@
  */
 
 /* inlining this will help show what fn that is taking time during profiling. */
-static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value)
+static inline void buf_set_u32(uint8_t* buffer,
+               unsigned int first, unsigned int num, uint32_t value)
 {
        if ((num == 32) && (first == 0))
        {
@@ -51,13 +52,16 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
                }
        }
 }
-static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num)
+static inline uint32_t buf_get_u32(const uint8_t* buffer,
+               unsigned int first, unsigned int num)
 {
        if ((num == 32) && (first == 0))
        {
-               return (((uint32_t)buffer[3]) << 24) | (((uint32_t)buffer[2]) << 16) | (((uint32_t)buffer[1]) << 8) | (((uint32_t)buffer[0]) << 0);
-       } else
-       {
+               return (((uint32_t)buffer[3]) << 24) |
+                       (((uint32_t)buffer[2]) << 16) |
+                       (((uint32_t)buffer[1]) << 8) |
+                       (((uint32_t)buffer[0]) << 0);
+       } else {
                uint32_t result = 0;
                unsigned int i;
 
@@ -71,30 +75,30 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, un
        }
 }
 
-extern uint32_t flip_u32(uint32_t value, unsigned int num);
+uint32_t flip_u32(uint32_t value, unsigned int num);
 
-extern int buf_cmp(const uint8_t *buf1, const uint8_t *buf2, int size);
-extern int buf_cmp_mask(const uint8_t *buf1, const uint8_t *buf2, const uint8_t *mask, int size);
-extern uint8_t* buf_cpy(const uint8_t *from, uint8_t *to, int size);
+int buf_cmp(const uint8_t *buf1, const uint8_t *buf2, int size);
+int buf_cmp_mask(const uint8_t *buf1, const uint8_t *buf2,
+               const uint8_t *mask, int size);
+uint8_t* buf_cpy(const uint8_t *from, uint8_t *to, int size);
 
-extern uint8_t* buf_set_ones(uint8_t *buf, int count);
-extern uint8_t* buf_set_buf(const uint8_t *src, int src_start, uint8_t *dst, int dst_start, int len);
+uint8_t* buf_set_ones(uint8_t *buf, int count);
+uint8_t* buf_set_buf(const uint8_t *src, int src_start,
+               uint8_t *dst, int dst_start, int len);
 
-extern int str_to_buf(const char *str, int len, uint8_t *bin_buf, int buf_size, int radix);
-extern char* buf_to_str(const uint8_t *buf, int size, int radix);
+int str_to_buf(const char *str, int len,
+               uint8_t *bin_buf, int buf_size, int radix);
+char* buf_to_str(const uint8_t *buf, int size, int radix);
 
 struct scan_field_s;
-extern int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field);
+int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field);
 
 #define CEIL(m, n)     (((m) + (n) - 1) / (n))
 
 /* read a uint32_t from a buffer in target memory endianness */
-static inline uint32_t fast_target_buffer_get_u32(const uint8_t *buffer, int little)
+static inline uint32_t fast_target_buffer_get_u32(const uint8_t *p, int le)
 {
-       if (little)
-               return le_to_h_u32(buffer);
-       else
-               return be_to_h_u32(buffer);
+       return le ? le_to_h_u32(p) : be_to_h_u32(p);
 }
 
 #endif /* BINARYBUFFER_H */
index 2d0142fd743b2fb63519b2575e8880406104d163..70b00c3292de41b8b7bd3152e348227a6bc528e6 100644 (file)
@@ -84,25 +84,36 @@ typedef struct command_s
        struct command_s *next;
 } command_t;
 
-extern command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, char* name, char** args, int argc), enum command_mode mode, char *help);
-extern int unregister_command(command_context_t *context, char *name);
-extern int unregister_all_commands(command_context_t *context);
-extern void command_set_output_handler(command_context_t* context, int (*output_handler)(struct command_context_s *context, const char* line), void *priv);
-extern command_context_t* copy_command_context(command_context_t* context);
-extern int command_context_mode(command_context_t *context, enum command_mode mode);
-extern command_context_t* command_init(void);
-extern int command_done(command_context_t *context);
-
-extern void command_print(command_context_t *context, const char *format, ...)
+command_t* register_command(command_context_t *context,
+               command_t *parent, char *name,
+               int (*handler)(struct command_context_s *context,
+                               char* name, char** args, int argc),
+               enum command_mode mode, char *help);
+
+int unregister_command(command_context_t *context, char *name);
+int unregister_all_commands(command_context_t *context);
+
+void command_set_output_handler(command_context_t* context,
+               int (*output_handler)(struct command_context_s *context,
+               const char* line), void *priv);
+
+command_context_t* copy_command_context(command_context_t* context);
+
+int command_context_mode(command_context_t *context, enum command_mode mode);
+
+command_context_t* command_init(void);
+int command_done(command_context_t *context);
+
+void command_print(command_context_t *context, const char *format, ...)
                __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
-extern void command_print_sameline(command_context_t *context, const char *format, ...)
+void command_print_sameline(command_context_t *context, const char *format, ...)
                __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
-extern int command_run_line(command_context_t *context, char *line);
-extern int command_run_linef(command_context_t *context, const char *format, ...)
+int command_run_line(command_context_t *context, char *line);
+int command_run_linef(command_context_t *context, const char *format, ...)
                __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
-extern void command_output_text(command_context_t *context, const char *data);
+void command_output_text(command_context_t *context, const char *data);
 
-extern void process_jim_events(void);
+void process_jim_events(void);
 
 #define                ERROR_COMMAND_CLOSE_CONNECTION          (-600)
 #define                ERROR_COMMAND_SYNTAX_ERROR                      (-601)
index 16bd8d84494d17a6081e28d5ab681ba1c127ec2e..5d601485a9661a40732061638131e4243ede03db 100644 (file)
 
 #include "command.h"
 
-extern int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]);
-extern int parse_config_file(struct command_context_s *cmd_ctx);
-extern void add_config_command (const char *cfg);
-extern void add_script_search_dir (const char *dir);
-extern int configuration_output_handler(struct command_context_s *context, const char* line);
-extern FILE *open_file_from_path (char *file, char *mode);
-extern char *find_file(const char *name);
+int parse_cmdline_args(struct command_context_s *cmd_ctx,
+               int argc, char *argv[]);
+
+int parse_config_file(struct command_context_s *cmd_ctx);
+void add_config_command(const char *cfg);
+
+void add_script_search_dir(const char *dir);
+
+int configuration_output_handler(struct command_context_s *cmd_ctx,
+               const char *line);
+
+FILE *open_file_from_path(char *file, char *mode);
+
+char *find_file(const char *name);
 
 #endif /* CONFIGURATION_H */
index d1e227ca6f5880079f721f7816c53c0d26527b1f..3f47cb9ba61bfa8cfb42bfd9de606a8e20d0f14d 100644 (file)
@@ -54,14 +54,20 @@ typedef struct fileio_s
        FILE *file;
 } fileio_t;
 
-extern int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written);
-extern int fileio_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read);
-extern int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer);
-extern int fileio_seek(fileio_t *fileio, uint32_t position);
-extern int fileio_close(fileio_t *fileio);
-extern int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type);
-extern int fileio_read_u32(fileio_t *fileio, uint32_t *data);
-extern int fileio_write_u32(fileio_t *fileio, uint32_t data);
+int fileio_open(fileio_t *fileio,
+       const char *url, enum fileio_access access, enum fileio_type type);
+int fileio_close(fileio_t *fileio);
+
+int fileio_seek(fileio_t *fileio, uint32_t position);
+int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer);
+
+int fileio_read(fileio_t *fileio,
+               uint32_t size, uint8_t *buffer, uint32_t *size_read);
+int fileio_write(fileio_t *fileio,
+               uint32_t size, const uint8_t *buffer, uint32_t *size_written);
+
+int fileio_read_u32(fileio_t *fileio, uint32_t *data);
+int fileio_write_u32(fileio_t *fileio, uint32_t data);
 
 #define ERROR_FILEIO_LOCATION_UNKNOWN  (-1200)
 #define ERROR_FILEIO_NOT_FOUND                 (-1201)
index f43e1e6cb0ba8c8bf3df1fc65c0a549b524a0d42..15bd3c86236a401f0fdd16e00a858a92f251967d 100644 (file)
@@ -59,20 +59,23 @@ enum log_levels
        LOG_LVL_DEBUG = 3
 };
 
-extern void log_printf(enum log_levels level, const char *file, int line,
+void log_printf(enum log_levels level, const char *file, int line,
        const char *function, const char *format, ...)
 __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
-extern void log_printf_lf(enum log_levels level, const char *file, int line,
+void log_printf_lf(enum log_levels level, const char *file, int line,
        const char *function, const char *format, ...)
 __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
-extern int log_register_commands(struct command_context_s *cmd_ctx);
-extern int log_init(struct command_context_s *cmd_ctx);
-extern int set_log_output(struct command_context_s *cmd_ctx, FILE *output);
-extern void keep_alive(void);
-extern void kept_alive(void);
-extern void alive_sleep(int ms);
-extern void busy_sleep(int ms);
 
+int log_init(struct command_context_s *cmd_ctx);
+int set_log_output(struct command_context_s *cmd_ctx, FILE *output);
+
+int log_register_commands(struct command_context_s *cmd_ctx);
+
+void keep_alive(void);
+void kept_alive(void);
+
+void alive_sleep(int ms);
+void busy_sleep(int ms);
 
 /* log entries can be paused and replayed roughly according to the try/catch/rethrow
  * concepts in C++
@@ -92,8 +95,8 @@ typedef struct log_callback_s
        struct log_callback_s *next;
 } log_callback_t;
 
-extern int log_add_callback(log_callback_fn fn, void *priv);
-extern int log_remove_callback(log_callback_fn fn, void *priv);
+int log_add_callback(log_callback_fn fn, void *priv);
+int log_remove_callback(log_callback_fn fn, void *priv);
 
 char *alloc_vprintf(const char *fmt, va_list ap);
 char *alloc_printf(const char *fmt, ...);
index f2c6e9443559c85cc8d55d5cd383d1827eed3c47..a029674f7a05f22373dcca579ffb2083cbcd6ac1 100644 (file)
@@ -65,7 +65,8 @@ struct timezone {
 #endif
 struct timezone;
 
-extern int gettimeofday(struct timeval *tv, struct timezone *tz);
+int gettimeofday(struct timeval *tv, struct timezone *tz);
+
 #endif
 
 #ifndef IN_REPLACEMENTS_C
@@ -105,11 +106,11 @@ void *fill_malloc(size_t size);
 
 /* GNU extensions to the C library that may be missing on some systems */
 #ifndef HAVE_STRNDUP
-extern char* strndup(const char *s, size_t n);
+char* strndup(const char *s, size_t n);
 #endif /* HAVE_STRNDUP */
 
 #ifndef HAVE_STRNLEN
-extern size_t strnlen(const char *s, size_t maxlen);
+size_t strnlen(const char *s, size_t maxlen);
 #endif /* HAVE_STRNLEN */
 
 #ifndef HAVE_USLEEP

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)