From 0a2e62f57734f820cd20e151d1150342408552ed Mon Sep 17 00:00:00 2001 From: gabrielgio Date: Sat, 17 Feb 2024 17:13:07 +0100 Subject: ref: Apply astyle --style=linux --- lib/util.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/util.c') diff --git a/lib/util.c b/lib/util.c index 6720082..895ca89 100644 --- a/lib/util.c +++ b/lib/util.c @@ -6,7 +6,8 @@ #define BUF_SIZE 100 -char* copy_achar(const char* src) { +char* copy_achar(const char* src) +{ int len = strlen(src) + 1; char* dest = (char*)malloc(sizeof(char)*len); strcpy(dest, src); @@ -14,8 +15,8 @@ char* copy_achar(const char* src) { return dest; } - -int load_or_save_db(sqlite3 *pInMemory, const char *zFilename, int isSave){ +int load_or_save_db(sqlite3 *pInMemory, const char *zFilename, int isSave) +{ int rc; /* Function return code */ sqlite3 *pFile; /* Database connection opened on zFilename */ sqlite3_backup *pBackup; /* Backup object used to copy data */ @@ -23,12 +24,12 @@ int load_or_save_db(sqlite3 *pInMemory, const char *zFilename, int isSave){ sqlite3 *pFrom; /* Database to copy from (pFile or pInMemory) */ rc = sqlite3_open(zFilename, &pFile); - if( rc==SQLITE_OK ){ + if( rc==SQLITE_OK ) { pFrom = (isSave ? pInMemory : pFile); pTo = (isSave ? pFile : pInMemory); pBackup = sqlite3_backup_init(pTo, "main", pFrom, "main"); - if( pBackup ){ + if( pBackup ) { (void)sqlite3_backup_step(pBackup, -1); (void)sqlite3_backup_finish(pBackup); } @@ -39,11 +40,11 @@ int load_or_save_db(sqlite3 *pInMemory, const char *zFilename, int isSave){ return rc; } -unsigned int count_file_lines(FILE *file) { +unsigned int count_file_lines(FILE *file) +{ char buf[BUF_SIZE]; unsigned int counter = 0; - for(;;) - { + for(;;) { size_t res = fread(buf, 1, BUF_SIZE, file); if (ferror(file)) return -1; -- cgit v1.2.3