2222 *
2323 * @return A new stinger_names_t.
2424 */
25- stinger_names_t *
25+ stinger_names_t *
2626stinger_names_new (int64_t max_types ) {
27- stinger_names_t * sn = xcalloc (sizeof (stinger_names_t ) +
27+ stinger_names_t * sn = xcalloc (sizeof (stinger_names_t ) +
2828 ((max_types + 1 ) * sizeof (int64_t ) * 1 ), sizeof (uint8_t ));
2929 stinger_names_init (sn ,max_types );
3030 return sn ;
@@ -36,10 +36,10 @@ stinger_names_init(stinger_names_t * sn, int64_t max_types) {
3636 int rc = sqlite3_open ("file:namesdb?mode=memory&cache=private" , & sn -> db );
3737
3838 if ( rc ) {
39- LOG_E_A ("Can't open names database: %s\n" , sqlite3_errmsg (sn -> db ));
39+ LOG_E_A ("Can't open names database: %s\n" , sqlite3_errmsg (sn -> db ));
4040 }
4141
42- const char * drop_sql =
42+ const char * drop_sql =
4343 "DROP TABLE IF EXISTS NAMES" ;
4444
4545 sqlite3_exec (sn -> db , drop_sql , NULL , NULL , NULL );
@@ -115,7 +115,7 @@ stinger_names_resize(stinger_names_t ** sn, int64_t max_types) {
115115
116116size_t
117117stinger_names_size (int64_t max_types ) {
118- size_t rtn = sizeof (stinger_names_t ) +
118+ size_t rtn = sizeof (stinger_names_t ) +
119119 (max_types * sizeof (int64_t ) * 1 ); /* to_int */
120120 return rtn ;
121121}
@@ -130,7 +130,7 @@ stinger_names_size(int64_t max_types) {
130130stinger_names_t *
131131stinger_names_free (stinger_names_t * * sn ) {
132132 if (sn && * sn ) {
133- const char * drop_sql =
133+ const char * drop_sql =
134134 "DROP TABLE IF EXISTS NAMES" ;
135135
136136 sqlite3_exec ((* sn )-> db , drop_sql , NULL , NULL , NULL );
@@ -177,7 +177,7 @@ stinger_names_create_type(stinger_names_t * sn, const char * name, int64_t * out
177177
178178 //fprintf(stderr,"SQLITE insert - %s - %ld\n",name,next_type);
179179
180- const char * create_sql =
180+ const char * create_sql =
181181 "INSERT OR IGNORE INTO NAMES "
182182 "(NAME, ID)"
183183 " VALUES "
@@ -187,13 +187,13 @@ stinger_names_create_type(stinger_names_t * sn, const char * name, int64_t * out
187187
188188 int rc ;
189189
190- rc = sqlite3_prepare_v2 (sn -> db , create_sql , -1 , & create_stmt , NULL );
191-
190+ rc = sqlite3_prepare_v2 (sn -> db , create_sql , -1 , & create_stmt , NULL );
191+
192192 rc = sqlite3_bind_text (create_stmt ,1 ,name ,-1 ,SQLITE_STATIC );
193193 rc = sqlite3_bind_int64 (create_stmt ,2 ,next_type );
194194 rc = sqlite3_step (create_stmt );
195195 if ( rc != SQLITE_DONE && rc != SQLITE_OK ) {
196- LOG_E_A ("Can't insert data: %d" , rc );
196+ LOG_E_A ("Can't insert data: %d" , rc );
197197 }
198198 sqlite3_finalize (create_stmt );
199199 return 1 ;
@@ -212,7 +212,7 @@ int64_t
212212stinger_names_lookup_type (stinger_names_t * sn , const char * name ) {
213213 MAP_SN (sn )
214214
215- const char * lookup_id_sql =
215+ const char * lookup_id_sql =
216216 "SELECT "
217217 " ID "
218218 " FROM "
@@ -252,7 +252,7 @@ char *
252252stinger_names_lookup_name (stinger_names_t * sn , int64_t type ) {
253253 MAP_SN (sn )
254254
255- const char * lookup_name_sql =
255+ const char * lookup_name_sql =
256256 "SELECT "
257257 "NAME "
258258 "FROM "
@@ -275,7 +275,7 @@ stinger_names_lookup_name(stinger_names_t * sn, int64_t type) {
275275 strcpy (name ,s_name );
276276 sqlite3_finalize (lookup_name_stmt );
277277 return name ;
278- } else {
278+ } else {
279279 sqlite3_finalize (lookup_name_stmt );
280280 return NULL ;
281281 }
@@ -345,10 +345,10 @@ int64_t
345345stinger_names_count (stinger_names_t * sn ) {
346346 sqlite3_stmt * stmt ;
347347
348- const char * count_sql =
349- "SELECT"
350- "COUNT(*)"
351- "FROM"
348+ const char * count_sql =
349+ "SELECT "
350+ "COUNT(*) "
351+ "FROM "
352352 "NAMES" ;
353353
354354 sqlite3_prepare_v2 (sn -> db , count_sql , -1 , & stmt , NULL );
@@ -370,7 +370,7 @@ stinger_names_print(stinger_names_t * sn) {
370370
371371 sqlite3_stmt * stmt ;
372372
373- const char * lookup_sql =
373+ const char * lookup_sql =
374374 "SELECT "
375375 "NAME, ID "
376376 "FROM "
@@ -453,4 +453,4 @@ int main(int argc, char *argv[]) {
453453}
454454#endif
455455
456- #endif
456+ #endif
0 commit comments