Fossil SCM
Several minor internal cleanups to the json code which i thought i had committed last week :/.
Commit
055dfb1223c42a2d89e388f5cf9d42c3b9f1c044
Parent
3e1dd97f77481a9…
5 files changed
+2
-2
+3
-16
+2
-2
+3
-1
+7
-3
+2
-2
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -1698,11 +1698,11 @@ | ||
| 1698 | 1698 | assert(NULL!=a); |
| 1699 | 1699 | } |
| 1700 | 1700 | if(!colNames){ |
| 1701 | 1701 | colNamesV = cson_sqlite3_column_names(pStmt->pStmt); |
| 1702 | 1702 | assert(NULL != colNamesV); |
| 1703 | - cson_value_add_reference(colNamesV)/*avoids an ownership problem*/; | |
| 1703 | + /*Why? cson_value_add_reference(colNamesV) avoids an ownership problem*/; | |
| 1704 | 1704 | colNames = cson_value_get_array(colNamesV); |
| 1705 | 1705 | assert(NULL != colNames); |
| 1706 | 1706 | } |
| 1707 | 1707 | row = cson_sqlite3_row_to_object2(pStmt->pStmt, colNames); |
| 1708 | 1708 | if(!row && !warnMsg){ |
| @@ -1709,14 +1709,14 @@ | ||
| 1709 | 1709 | warnMsg = "Could not convert at least one result row to JSON."; |
| 1710 | 1710 | continue; |
| 1711 | 1711 | } |
| 1712 | 1712 | if( 0 != cson_array_append(a, row) ){ |
| 1713 | 1713 | cson_value_free(row); |
| 1714 | - assert( 0 && "Alloc error."); | |
| 1715 | 1714 | if(pTgt != a) { |
| 1716 | 1715 | cson_free_array(a); |
| 1717 | 1716 | } |
| 1717 | + assert( 0 && "Alloc error."); | |
| 1718 | 1718 | return NULL; |
| 1719 | 1719 | } |
| 1720 | 1720 | } |
| 1721 | 1721 | cson_value_free(colNamesV); |
| 1722 | 1722 | if(warnMsg){ |
| 1723 | 1723 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1698,11 +1698,11 @@ | |
| 1698 | assert(NULL!=a); |
| 1699 | } |
| 1700 | if(!colNames){ |
| 1701 | colNamesV = cson_sqlite3_column_names(pStmt->pStmt); |
| 1702 | assert(NULL != colNamesV); |
| 1703 | cson_value_add_reference(colNamesV)/*avoids an ownership problem*/; |
| 1704 | colNames = cson_value_get_array(colNamesV); |
| 1705 | assert(NULL != colNames); |
| 1706 | } |
| 1707 | row = cson_sqlite3_row_to_object2(pStmt->pStmt, colNames); |
| 1708 | if(!row && !warnMsg){ |
| @@ -1709,14 +1709,14 @@ | |
| 1709 | warnMsg = "Could not convert at least one result row to JSON."; |
| 1710 | continue; |
| 1711 | } |
| 1712 | if( 0 != cson_array_append(a, row) ){ |
| 1713 | cson_value_free(row); |
| 1714 | assert( 0 && "Alloc error."); |
| 1715 | if(pTgt != a) { |
| 1716 | cson_free_array(a); |
| 1717 | } |
| 1718 | return NULL; |
| 1719 | } |
| 1720 | } |
| 1721 | cson_value_free(colNamesV); |
| 1722 | if(warnMsg){ |
| 1723 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1698,11 +1698,11 @@ | |
| 1698 | assert(NULL!=a); |
| 1699 | } |
| 1700 | if(!colNames){ |
| 1701 | colNamesV = cson_sqlite3_column_names(pStmt->pStmt); |
| 1702 | assert(NULL != colNamesV); |
| 1703 | /*Why? cson_value_add_reference(colNamesV) avoids an ownership problem*/; |
| 1704 | colNames = cson_value_get_array(colNamesV); |
| 1705 | assert(NULL != colNames); |
| 1706 | } |
| 1707 | row = cson_sqlite3_row_to_object2(pStmt->pStmt, colNames); |
| 1708 | if(!row && !warnMsg){ |
| @@ -1709,14 +1709,14 @@ | |
| 1709 | warnMsg = "Could not convert at least one result row to JSON."; |
| 1710 | continue; |
| 1711 | } |
| 1712 | if( 0 != cson_array_append(a, row) ){ |
| 1713 | cson_value_free(row); |
| 1714 | if(pTgt != a) { |
| 1715 | cson_free_array(a); |
| 1716 | } |
| 1717 | assert( 0 && "Alloc error."); |
| 1718 | return NULL; |
| 1719 | } |
| 1720 | } |
| 1721 | cson_value_free(colNamesV); |
| 1722 | if(warnMsg){ |
| 1723 |
+3
-16
| --- src/json_detail.h | ||
| +++ src/json_detail.h | ||
| @@ -172,10 +172,13 @@ | ||
| 172 | 172 | ** <0 = CLI only, >0 = HTTP only, 0==both |
| 173 | 173 | ** |
| 174 | 174 | ** Now that we can simulate POST in CLI mode, the distinction |
| 175 | 175 | ** between them has disappeared in most (or all) cases, so 0 is the |
| 176 | 176 | ** the standard value. |
| 177 | + ** | |
| 178 | + ** 201207: this is not needed any more. We can get rid of it. Or | |
| 179 | + ** keep it around in case it becomes useful again at some point. | |
| 177 | 180 | */ |
| 178 | 181 | char runMode; |
| 179 | 182 | } JsonPageDef; |
| 180 | 183 | |
| 181 | 184 | /* |
| @@ -212,26 +215,10 @@ | ||
| 212 | 215 | ** set in that case, so the caller must check that or pass it on up |
| 213 | 216 | ** the dispatch chain). |
| 214 | 217 | */ |
| 215 | 218 | cson_value * json_page_dispatch_helper(JsonPageDef const * pages); |
| 216 | 219 | |
| 217 | -/* | |
| 218 | -** Implements the /json/wiki family of pages/commands. | |
| 219 | -** | |
| 220 | -*/ | |
| 221 | -cson_value * json_page_wiki(); | |
| 222 | - | |
| 223 | -/* | |
| 224 | -** Implements /json/timeline/wiki and /json/wiki/timeline. | |
| 225 | -*/ | |
| 226 | -cson_value * json_timeline_wiki(); | |
| 227 | - | |
| 228 | -/* | |
| 229 | -** Implements /json/timeline family of functions. | |
| 230 | -*/ | |
| 231 | -cson_value * json_page_timeline(); | |
| 232 | - | |
| 233 | 220 | /* |
| 234 | 221 | ** Convenience wrapper around cson_value_new_string(). |
| 235 | 222 | ** Returns NULL if str is NULL or on allocation error. |
| 236 | 223 | */ |
| 237 | 224 | cson_value * json_new_string( char const * str ); |
| 238 | 225 |
| --- src/json_detail.h | |
| +++ src/json_detail.h | |
| @@ -172,10 +172,13 @@ | |
| 172 | ** <0 = CLI only, >0 = HTTP only, 0==both |
| 173 | ** |
| 174 | ** Now that we can simulate POST in CLI mode, the distinction |
| 175 | ** between them has disappeared in most (or all) cases, so 0 is the |
| 176 | ** the standard value. |
| 177 | */ |
| 178 | char runMode; |
| 179 | } JsonPageDef; |
| 180 | |
| 181 | /* |
| @@ -212,26 +215,10 @@ | |
| 212 | ** set in that case, so the caller must check that or pass it on up |
| 213 | ** the dispatch chain). |
| 214 | */ |
| 215 | cson_value * json_page_dispatch_helper(JsonPageDef const * pages); |
| 216 | |
| 217 | /* |
| 218 | ** Implements the /json/wiki family of pages/commands. |
| 219 | ** |
| 220 | */ |
| 221 | cson_value * json_page_wiki(); |
| 222 | |
| 223 | /* |
| 224 | ** Implements /json/timeline/wiki and /json/wiki/timeline. |
| 225 | */ |
| 226 | cson_value * json_timeline_wiki(); |
| 227 | |
| 228 | /* |
| 229 | ** Implements /json/timeline family of functions. |
| 230 | */ |
| 231 | cson_value * json_page_timeline(); |
| 232 | |
| 233 | /* |
| 234 | ** Convenience wrapper around cson_value_new_string(). |
| 235 | ** Returns NULL if str is NULL or on allocation error. |
| 236 | */ |
| 237 | cson_value * json_new_string( char const * str ); |
| 238 |
| --- src/json_detail.h | |
| +++ src/json_detail.h | |
| @@ -172,10 +172,13 @@ | |
| 172 | ** <0 = CLI only, >0 = HTTP only, 0==both |
| 173 | ** |
| 174 | ** Now that we can simulate POST in CLI mode, the distinction |
| 175 | ** between them has disappeared in most (or all) cases, so 0 is the |
| 176 | ** the standard value. |
| 177 | ** |
| 178 | ** 201207: this is not needed any more. We can get rid of it. Or |
| 179 | ** keep it around in case it becomes useful again at some point. |
| 180 | */ |
| 181 | char runMode; |
| 182 | } JsonPageDef; |
| 183 | |
| 184 | /* |
| @@ -212,26 +215,10 @@ | |
| 215 | ** set in that case, so the caller must check that or pass it on up |
| 216 | ** the dispatch chain). |
| 217 | */ |
| 218 | cson_value * json_page_dispatch_helper(JsonPageDef const * pages); |
| 219 | |
| 220 | /* |
| 221 | ** Convenience wrapper around cson_value_new_string(). |
| 222 | ** Returns NULL if str is NULL or on allocation error. |
| 223 | */ |
| 224 | cson_value * json_new_string( char const * str ); |
| 225 |
+2
-2
| --- src/json_report.c | ||
| +++ src/json_report.c | ||
| @@ -51,11 +51,11 @@ | ||
| 51 | 51 | if(!g.perm.RdTkt && !g.perm.NewTkt ){ |
| 52 | 52 | json_set_err(FSL_JSON_E_DENIED, |
| 53 | 53 | "Requires 'r' or 'n' permissions."); |
| 54 | 54 | return NULL; |
| 55 | 55 | } |
| 56 | - return json_page_dispatch_helper(&JsonPageDefs_Report[0]); | |
| 56 | + return json_page_dispatch_helper(JsonPageDefs_Report); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /* |
| 60 | 60 | ** Searches the environment for a "report" parameter |
| 61 | 61 | ** (CLI: -report/-r #). |
| @@ -249,15 +249,15 @@ | ||
| 249 | 249 | |
| 250 | 250 | error: |
| 251 | 251 | assert(0 != g.json.resultCode); |
| 252 | 252 | cson_value_free( cson_object_value(pay) ); |
| 253 | 253 | pay = NULL; |
| 254 | - end: | |
| 254 | + end: | |
| 255 | 255 | |
| 256 | 256 | return pay ? cson_object_value(pay) : NULL; |
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | static cson_value * json_report_save(){ |
| 261 | 261 | return NULL; |
| 262 | 262 | } |
| 263 | 263 | #endif /* FOSSIL_ENABLE_JSON */ |
| 264 | 264 |
| --- src/json_report.c | |
| +++ src/json_report.c | |
| @@ -51,11 +51,11 @@ | |
| 51 | if(!g.perm.RdTkt && !g.perm.NewTkt ){ |
| 52 | json_set_err(FSL_JSON_E_DENIED, |
| 53 | "Requires 'r' or 'n' permissions."); |
| 54 | return NULL; |
| 55 | } |
| 56 | return json_page_dispatch_helper(&JsonPageDefs_Report[0]); |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | ** Searches the environment for a "report" parameter |
| 61 | ** (CLI: -report/-r #). |
| @@ -249,15 +249,15 @@ | |
| 249 | |
| 250 | error: |
| 251 | assert(0 != g.json.resultCode); |
| 252 | cson_value_free( cson_object_value(pay) ); |
| 253 | pay = NULL; |
| 254 | end: |
| 255 | |
| 256 | return pay ? cson_object_value(pay) : NULL; |
| 257 | |
| 258 | } |
| 259 | |
| 260 | static cson_value * json_report_save(){ |
| 261 | return NULL; |
| 262 | } |
| 263 | #endif /* FOSSIL_ENABLE_JSON */ |
| 264 |
| --- src/json_report.c | |
| +++ src/json_report.c | |
| @@ -51,11 +51,11 @@ | |
| 51 | if(!g.perm.RdTkt && !g.perm.NewTkt ){ |
| 52 | json_set_err(FSL_JSON_E_DENIED, |
| 53 | "Requires 'r' or 'n' permissions."); |
| 54 | return NULL; |
| 55 | } |
| 56 | return json_page_dispatch_helper(JsonPageDefs_Report); |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | ** Searches the environment for a "report" parameter |
| 61 | ** (CLI: -report/-r #). |
| @@ -249,15 +249,15 @@ | |
| 249 | |
| 250 | error: |
| 251 | assert(0 != g.json.resultCode); |
| 252 | cson_value_free( cson_object_value(pay) ); |
| 253 | pay = NULL; |
| 254 | end: |
| 255 | |
| 256 | return pay ? cson_object_value(pay) : NULL; |
| 257 | |
| 258 | } |
| 259 | |
| 260 | static cson_value * json_report_save(){ |
| 261 | return NULL; |
| 262 | } |
| 263 | #endif /* FOSSIL_ENABLE_JSON */ |
| 264 |
+3
-1
| --- src/json_user.c | ||
| +++ src/json_user.c | ||
| @@ -356,11 +356,11 @@ | ||
| 356 | 356 | #endif |
| 357 | 357 | db_prepare(&q, "%s", blob_str(&sql)); |
| 358 | 358 | db_exec(&q); |
| 359 | 359 | db_finalize(&q); |
| 360 | 360 | #if TRY_LOGIN_GROUP |
| 361 | - if( zPW || forceLogout ){ | |
| 361 | + if( zPW || cson_value_get_bool(forceLogout) ){ | |
| 362 | 362 | Blob groupSql = empty_blob; |
| 363 | 363 | char * zErr = NULL; |
| 364 | 364 | blob_appendf(&groupSql, |
| 365 | 365 | "INSERT INTO user(login)" |
| 366 | 366 | " SELECT %Q WHERE NOT EXISTS(SELECT 1 FROM user WHERE login=%Q);", |
| @@ -403,17 +403,19 @@ | ||
| 403 | 403 | char const * str = NULL; |
| 404 | 404 | char b = -1; |
| 405 | 405 | int i = -1; |
| 406 | 406 | int uid = -1; |
| 407 | 407 | cson_value * payload = NULL; |
| 408 | + /* String properties... */ | |
| 408 | 409 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| 409 | 410 | if(str){ cson_object_set(u, LK, json_new_string(str)); } (void)0 |
| 410 | 411 | PROP("name","n"); |
| 411 | 412 | PROP("password","p"); |
| 412 | 413 | PROP("info","i"); |
| 413 | 414 | PROP("capabilities","c"); |
| 414 | 415 | #undef PROP |
| 416 | + /* Boolean properties... */ | |
| 415 | 417 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 416 | 418 | if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0 |
| 417 | 419 | PROP("forceLogout",-1); |
| 418 | 420 | #undef PROP |
| 419 | 421 | |
| 420 | 422 |
| --- src/json_user.c | |
| +++ src/json_user.c | |
| @@ -356,11 +356,11 @@ | |
| 356 | #endif |
| 357 | db_prepare(&q, "%s", blob_str(&sql)); |
| 358 | db_exec(&q); |
| 359 | db_finalize(&q); |
| 360 | #if TRY_LOGIN_GROUP |
| 361 | if( zPW || forceLogout ){ |
| 362 | Blob groupSql = empty_blob; |
| 363 | char * zErr = NULL; |
| 364 | blob_appendf(&groupSql, |
| 365 | "INSERT INTO user(login)" |
| 366 | " SELECT %Q WHERE NOT EXISTS(SELECT 1 FROM user WHERE login=%Q);", |
| @@ -403,17 +403,19 @@ | |
| 403 | char const * str = NULL; |
| 404 | char b = -1; |
| 405 | int i = -1; |
| 406 | int uid = -1; |
| 407 | cson_value * payload = NULL; |
| 408 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| 409 | if(str){ cson_object_set(u, LK, json_new_string(str)); } (void)0 |
| 410 | PROP("name","n"); |
| 411 | PROP("password","p"); |
| 412 | PROP("info","i"); |
| 413 | PROP("capabilities","c"); |
| 414 | #undef PROP |
| 415 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 416 | if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0 |
| 417 | PROP("forceLogout",-1); |
| 418 | #undef PROP |
| 419 | |
| 420 |
| --- src/json_user.c | |
| +++ src/json_user.c | |
| @@ -356,11 +356,11 @@ | |
| 356 | #endif |
| 357 | db_prepare(&q, "%s", blob_str(&sql)); |
| 358 | db_exec(&q); |
| 359 | db_finalize(&q); |
| 360 | #if TRY_LOGIN_GROUP |
| 361 | if( zPW || cson_value_get_bool(forceLogout) ){ |
| 362 | Blob groupSql = empty_blob; |
| 363 | char * zErr = NULL; |
| 364 | blob_appendf(&groupSql, |
| 365 | "INSERT INTO user(login)" |
| 366 | " SELECT %Q WHERE NOT EXISTS(SELECT 1 FROM user WHERE login=%Q);", |
| @@ -403,17 +403,19 @@ | |
| 403 | char const * str = NULL; |
| 404 | char b = -1; |
| 405 | int i = -1; |
| 406 | int uid = -1; |
| 407 | cson_value * payload = NULL; |
| 408 | /* String properties... */ |
| 409 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| 410 | if(str){ cson_object_set(u, LK, json_new_string(str)); } (void)0 |
| 411 | PROP("name","n"); |
| 412 | PROP("password","p"); |
| 413 | PROP("info","i"); |
| 414 | PROP("capabilities","c"); |
| 415 | #undef PROP |
| 416 | /* Boolean properties... */ |
| 417 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 418 | if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0 |
| 419 | PROP("forceLogout",-1); |
| 420 | #undef PROP |
| 421 | |
| 422 |
+7
-3
| --- src/json_wiki.c | ||
| +++ src/json_wiki.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | #ifdef FOSSIL_ENABLE_JSON |
| 2 | 2 | /* |
| 3 | -** Copyright (c) 2011 D. Richard Hipp | |
| 3 | +** Copyright (c) 2011-12 D. Richard Hipp | |
| 4 | 4 | ** |
| 5 | 5 | ** This program is free software; you can redistribute it and/or |
| 6 | 6 | ** modify it under the terms of the Simplified BSD License (also |
| 7 | 7 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 8 | 8 | ** |
| @@ -48,13 +48,18 @@ | ||
| 48 | 48 | /* |
| 49 | 49 | ** Implements the /json/wiki family of pages/commands. |
| 50 | 50 | ** |
| 51 | 51 | */ |
| 52 | 52 | cson_value * json_page_wiki(){ |
| 53 | - return json_page_dispatch_helper(&JsonPageDefs_Wiki[0]); | |
| 53 | + return json_page_dispatch_helper(JsonPageDefs_Wiki); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | +/* | |
| 57 | +** Returns the UUID for the given wiki blob RID, or NULL if not | |
| 58 | +** found. The returned string is allocated via db_text() and must be | |
| 59 | +** free()d by the caller. | |
| 60 | +*/ | |
| 56 | 61 | char * json_wiki_get_uuid_for_rid( int rid ) |
| 57 | 62 | { |
| 58 | 63 | return db_text(NULL, |
| 59 | 64 | "SELECT b.uuid FROM tag t, tagxref x, blob b" |
| 60 | 65 | " WHERE x.tagid=t.tagid AND t.tagname GLOB 'wiki-*' " |
| @@ -83,11 +88,10 @@ | ||
| 83 | 88 | json_set_err( FSL_JSON_E_UNKNOWN, |
| 84 | 89 | "Error reading wiki page from manifest (rid=%d).", |
| 85 | 90 | rid ); |
| 86 | 91 | return NULL; |
| 87 | 92 | }else{ |
| 88 | - /*char const * zFormat = NULL;*/ | |
| 89 | 93 | unsigned int len = 0; |
| 90 | 94 | cson_object * pay = cson_new_object(); |
| 91 | 95 | char const * zBody = pWiki->zWiki; |
| 92 | 96 | char const * zFormat = NULL; |
| 93 | 97 | char * zUuid = json_wiki_get_uuid_for_rid(rid); |
| 94 | 98 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | #ifdef FOSSIL_ENABLE_JSON |
| 2 | /* |
| 3 | ** Copyright (c) 2011 D. Richard Hipp |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or |
| 6 | ** modify it under the terms of the Simplified BSD License (also |
| 7 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 8 | ** |
| @@ -48,13 +48,18 @@ | |
| 48 | /* |
| 49 | ** Implements the /json/wiki family of pages/commands. |
| 50 | ** |
| 51 | */ |
| 52 | cson_value * json_page_wiki(){ |
| 53 | return json_page_dispatch_helper(&JsonPageDefs_Wiki[0]); |
| 54 | } |
| 55 | |
| 56 | char * json_wiki_get_uuid_for_rid( int rid ) |
| 57 | { |
| 58 | return db_text(NULL, |
| 59 | "SELECT b.uuid FROM tag t, tagxref x, blob b" |
| 60 | " WHERE x.tagid=t.tagid AND t.tagname GLOB 'wiki-*' " |
| @@ -83,11 +88,10 @@ | |
| 83 | json_set_err( FSL_JSON_E_UNKNOWN, |
| 84 | "Error reading wiki page from manifest (rid=%d).", |
| 85 | rid ); |
| 86 | return NULL; |
| 87 | }else{ |
| 88 | /*char const * zFormat = NULL;*/ |
| 89 | unsigned int len = 0; |
| 90 | cson_object * pay = cson_new_object(); |
| 91 | char const * zBody = pWiki->zWiki; |
| 92 | char const * zFormat = NULL; |
| 93 | char * zUuid = json_wiki_get_uuid_for_rid(rid); |
| 94 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | #ifdef FOSSIL_ENABLE_JSON |
| 2 | /* |
| 3 | ** Copyright (c) 2011-12 D. Richard Hipp |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or |
| 6 | ** modify it under the terms of the Simplified BSD License (also |
| 7 | ** known as the "2-Clause License" or "FreeBSD License".) |
| 8 | ** |
| @@ -48,13 +48,18 @@ | |
| 48 | /* |
| 49 | ** Implements the /json/wiki family of pages/commands. |
| 50 | ** |
| 51 | */ |
| 52 | cson_value * json_page_wiki(){ |
| 53 | return json_page_dispatch_helper(JsonPageDefs_Wiki); |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | ** Returns the UUID for the given wiki blob RID, or NULL if not |
| 58 | ** found. The returned string is allocated via db_text() and must be |
| 59 | ** free()d by the caller. |
| 60 | */ |
| 61 | char * json_wiki_get_uuid_for_rid( int rid ) |
| 62 | { |
| 63 | return db_text(NULL, |
| 64 | "SELECT b.uuid FROM tag t, tagxref x, blob b" |
| 65 | " WHERE x.tagid=t.tagid AND t.tagname GLOB 'wiki-*' " |
| @@ -83,11 +88,10 @@ | |
| 88 | json_set_err( FSL_JSON_E_UNKNOWN, |
| 89 | "Error reading wiki page from manifest (rid=%d).", |
| 90 | rid ); |
| 91 | return NULL; |
| 92 | }else{ |
| 93 | unsigned int len = 0; |
| 94 | cson_object * pay = cson_new_object(); |
| 95 | char const * zBody = pWiki->zWiki; |
| 96 | char const * zFormat = NULL; |
| 97 | char * zUuid = json_wiki_get_uuid_for_rid(rid); |
| 98 |