From c09c6c1f1bad50f352103fe9b711208ed3b9c1c4 Mon Sep 17 00:00:00 2001 From: Nikolai Nosov Date: Wed, 5 Feb 2020 22:35:08 +0400 Subject: [PATCH] make non-public context functions static --- src/context.c | 11 ++++++----- src/context.h | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/context.c b/src/context.c index f8076c8..5d9670b 100644 --- a/src/context.c +++ b/src/context.c @@ -20,12 +20,13 @@ extern int regnum; pst_log logger; // logger for library pst_allocator allocator; // custom allocator for PST library -void clean_print(pst_context* ctx) { +static void clean_print(pst_context* ctx) +{ ctx->buff[0] = 0; ctx->offset = 0; } -void print_stack(pst_context* ctx, int max, uint64_t next_cfa) +static void print_stack(pst_context* ctx, int max, uint64_t next_cfa) { pst_log(SEVERITY_DEBUG, "CFA = %#lX, NEXT_CFA = %#lX, SP = %#lX", ctx->cfa, next_cfa, ctx->sp); ctx->clean_print(ctx); @@ -44,7 +45,7 @@ void print_stack(pst_context* ctx, int max, uint64_t next_cfa) } } -void print_registers(pst_context* ctx, int from, int to) +static void print_registers(pst_context* ctx, int from, int to) { ctx->clean_print(ctx); for(int i = from; i < regnum && i <= to; ++i) { @@ -57,7 +58,7 @@ void print_registers(pst_context* ctx, int from, int to) } } -bool print(pst_context* ctx, const char* fmt, ...) +static bool print(pst_context* ctx, const char* fmt, ...) { bool nret = true; @@ -74,7 +75,7 @@ bool print(pst_context* ctx, const char* fmt, ...) return nret; } -bool print_expr_block (pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr) +static bool print_expr_block (pst_context* ctx, Dwarf_Op *exprs, int exprlen, Dwarf_Attribute* attr) { ctx->clean_print(ctx); for (int i = 0; i < exprlen; i++) { diff --git a/src/context.h b/src/context.h index 326dbe1..6d54e45 100644 --- a/src/context.h +++ b/src/context.h @@ -5,8 +5,8 @@ * Author: nnosov */ -#ifndef FRAMEWORK_CONTEXT_H_ -#define FRAMEWORK_CONTEXT_H_ +#ifndef __PST_CONTEXT_H__ +#define __PST_CONTEXT_H__ #include #include @@ -58,4 +58,4 @@ typedef struct __pst_context { void pst_context_init(pst_context* ctx, ucontext_t* hctx); void pst_context_fini(pst_context* ctx); -#endif /* FRAMEWORK_CONTEXT_H_ */ +#endif /* __PST_CONTEXT_H__ */