Skip to content

Commit

Permalink
hidden unwanted externally visible functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rishithaminol committed Mar 21, 2018
1 parent f62cd3a commit 66cde10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 12 additions & 6 deletions mysql_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
#include "json_parser.h"
#include "cm_debug.h"

/* @brief lock db access */

/* @brief lock db access. should be initialized by 'cmarketcap.c' */
pthread_mutex_t mysql_db_access = PTHREAD_MUTEX_INITIALIZER;
#define LOCK_DB_ACCESS pthread_mutex_lock(&mysql_db_access)
#define UNLOCK_DB_ACCESS pthread_mutex_unlock(&mysql_db_access)

static struct coin_status *mk_coin_status(const char *coin_id, const char *col1,
int col1_rank, const char *col2, int col2_rank);
static struct coin_status_base *init_coin_status_base();
static void append_coin_status(struct coin_status_base *sb, struct coin_status *st);

void free_coin_status_base(struct coin_status_base *sb)
{
struct coin_status *stat1, *stat2;
Expand Down Expand Up @@ -52,7 +58,7 @@ void print_coin_status_base(struct coin_status_base *sb)
}
}

struct coin_status *mk_coin_status(const char *coin_id, const char *col1,
static struct coin_status *mk_coin_status(const char *coin_id, const char *col1,
int col1_rank, const char *col2, int col2_rank)
{
struct coin_status *coin_stat;
Expand All @@ -70,7 +76,7 @@ struct coin_status *mk_coin_status(const char *coin_id, const char *col1,
return coin_stat;
}

struct coin_status_base *init_coin_status_base()
static struct coin_status_base *init_coin_status_base()
{
struct coin_status_base *coin_stat_base;

Expand All @@ -84,7 +90,7 @@ struct coin_status_base *init_coin_status_base()
return coin_stat_base;
}

void append_coin_status(struct coin_status_base *sb, struct coin_status *st)
static void append_coin_status(struct coin_status_base *sb, struct coin_status *st)
{
if (sb->first == NULL) {/* first and last NULL */
sb->first = st;
Expand Down Expand Up @@ -123,7 +129,7 @@ void close_main_db(MYSQL *db)
mysql_close(db);
}

/** @brief Initialize 'coin_history' table's 'coin_id' field
/** @brief Initialize 'coin_history' table's 'coin_key' field
*
* @todo This function should have a way of updating newly arrived coins.
* And there should be a way of informing dropped coins
Expand Down Expand Up @@ -151,7 +157,7 @@ void init_coin_history_table(MYSQL *db, struct coin_entry_base *coin_base)
UNLOCK_DB_ACCESS;
}

/** @brief Fill first column of the table.
/** @brief Fill first quarter column of the table.
*
* Updates the 'time_stamp' table. parameter col always
* takes a name from an array from the caller. eg:- min_0
Expand Down
4 changes: 0 additions & 4 deletions mysql_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ extern void init_coin_history_table(MYSQL *db, struct coin_entry_base *coin_base

extern void free_coin_status_base(struct coin_status_base *sb);
extern void print_coin_status_base(struct coin_status_base *sb);
extern struct coin_status *mk_coin_status(const char *coin_id, const char *col1,
int col1_rank, const char *col2, int col2_rank);
extern struct coin_status_base *init_coin_status_base();
extern void append_coin_status(struct coin_status_base *sb, struct coin_status *st);
extern void cm_update_table(MYSQL *db, struct coin_entry_base *coin_base);
extern void shift_columns(MYSQL *db, const char *col1, const char *col2);
extern struct coin_status_base *fetch_entire_rank(MYSQL *db);
Expand Down

0 comments on commit 66cde10

Please sign in to comment.