Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | (json wiki save) now returns the results of (json wiki get) but without the page content. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
70ea765873e3d5343b1f1ae712cdc4ea |
User & Date: | stephan 2012-02-12 10:58:39.601 |
Context
2012-02-12
| ||
11:04 | minor doc clarification for the previous commit. ... (check-in: f42096f7 user: stephan tags: trunk) | |
10:58 | (json wiki save) now returns the results of (json wiki get) but without the page content. ... (check-in: 70ea7658 user: stephan tags: trunk) | |
10:42 | (json wiki get) now supports returning the page metadata without the content. Fixed an arg-forwarding bug in json_find_option_cstr() which caused long-form args to be ignored. ... (check-in: 913e0b66 user: stephan tags: trunk) | |
Changes
Changes to src/json_wiki.c.
︙ | ︙ | |||
222 223 224 225 226 227 228 | ** much automatically" (and i would likely agree with them). ** ** If allowCreateIfExists is true then this function will allow a new ** page to be created even if createMode is false. */ static cson_value * json_wiki_create_or_save(char createMode, char allowCreateIfExists){ | | | > | | | < | < < < | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | ** much automatically" (and i would likely agree with them). ** ** If allowCreateIfExists is true then this function will allow a new ** page to be created even if createMode is false. */ static cson_value * json_wiki_create_or_save(char createMode, char allowCreateIfExists){ Blob content = empty_blob; /* wiki page content */ cson_value * nameV; /* wiki page name */ char const * zPageName; /* cstr form of page name */ cson_value * contentV; /* passed-in content */ cson_value * emptyContent = NULL; /* placeholder for empty content. */ cson_value * payV = NULL; /* payload/return value */ cson_string const * jstr = NULL; /* temp for cson_value-to-cson_string conversions. */ unsigned int contentLen = 0; int rid; if( (createMode && !g.perm.NewWiki) || (!createMode && !g.perm.WrWiki)){ json_set_err(FSL_JSON_E_DENIED, "Requires '%c' permissions.", (createMode ? 'f' : 'k')); |
︙ | ︙ | |||
292 293 294 295 296 297 298 | jstr = cson_value_get_string(contentV); contentLen = (int)cson_string_length_bytes(jstr); if(contentLen){ blob_append(&content, cson_string_cstr(jstr),contentLen); } wiki_cmd_commit(zPageName, 0==rid, &content); blob_reset(&content); | | > > > > | > | | < < | | < < | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | jstr = cson_value_get_string(contentV); contentLen = (int)cson_string_length_bytes(jstr); if(contentLen){ blob_append(&content, cson_string_cstr(jstr),contentLen); } wiki_cmd_commit(zPageName, 0==rid, &content); blob_reset(&content); /* Our return value here has a race condition: if the page is saved again before the next line finishes, payV could be the results of the other save operation. */ payV = json_get_wiki_page_by_name( cson_string_cstr( cson_value_get_string(nameV)), 0); assert( 0 != g.json.resultCode ); goto ok; error: assert( NULL == payV ); ok: if( emptyContent ){ /* We have some potentially tricky memory ownership here, which is why we handle emptyContent separately. This is, in fact, overkill because cson_value_new_string("",0) actually returns a shared singleton instance (i.e. doesn't |
︙ | ︙ |