Fossil SCM

Removed the json warnings bitset crap. Still not sure i like the warnings mechanism at all.

stephan 2011-09-29 21:57 UTC json
Commit 9fe06e2fdad0dba1492a972e2352a3c3c0633fa4
+16 -14
--- src/json.c
+++ src/json.c
@@ -726,13 +726,10 @@
726726
cson_value * objV = NULL;
727727
cson_object * obj = NULL;
728728
assert( (code>FSL_JSON_W_START)
729729
&& (code<FSL_JSON_W_END)
730730
&& "Invalid warning code.");
731
- if( BITSET_GET(g.json.warnings.bitset,code) ){
732
- return;
733
- }
734731
if(!g.json.warnings.v){
735732
g.json.warnings.v = cson_value_new_array();
736733
assert((NULL != g.json.warnings.v) && "Alloc error.");
737734
g.json.warnings.a = cson_value_get_array(g.json.warnings.v);
738735
json_gc_add("$WARNINGS",g.json.warnings.v,0);
@@ -746,11 +743,10 @@
746743
/* FIXME: treat NULL msg as standard warning message for
747744
the code, but we don't have those yet.
748745
*/
749746
cson_object_set(obj,"text",cson_value_new_string(msg,strlen(msg)));
750747
}
751
- BITSET_SET(g.json.warnings.bitset,code);
752748
}
753749
754750
/*
755751
** Splits zStr (which must not be NULL) into tokens separated by the
756752
** given separator character. If doDeHttp is true then each element
@@ -1305,24 +1301,27 @@
13051301
** object and this function will return pTgt. If pTgt is NULL then a
13061302
** new Array object is created and returned (owned by the
13071303
** caller). Each row of pStmt is converted to an Object and appended
13081304
** to the array.
13091305
*/
1310
-static cson_value * json_stmt_to_array_of_obj(Stmt *pStmt,
1311
- cson_value * pTgt){
1306
+cson_value * json_stmt_to_array_of_obj(Stmt *pStmt,
1307
+ cson_value * pTgt){
13121308
cson_value * v = pTgt ? pTgt : cson_value_new_array();
13131309
cson_array * a = cson_value_get_array(pTgt ? pTgt : v);
1310
+ char const * warnMsg = NULL;
13141311
assert( NULL != a );
13151312
while( (SQLITE_ROW==db_step(pStmt)) ){
13161313
cson_value * row = cson_sqlite3_row_to_object(pStmt->pStmt);
1317
- if(!row){
1318
- json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
1319
- "Could not convert at least one result row to JSON." );
1314
+ if(!row && !warnMsg){
1315
+ warnMsg = "Could not convert at least one result row to JSON.";
13201316
continue;
13211317
}
13221318
cson_array_append(a, row);
13231319
}
1320
+ if(warnMsg){
1321
+ json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED, warnMsg );
1322
+ }
13241323
return v;
13251324
}
13261325
13271326
/*
13281327
** /json/version implementation.
@@ -1606,10 +1605,11 @@
16061605
cson_object * pay;
16071606
cson_value * listV;
16081607
cson_array * list;
16091608
char const * range = NULL;
16101609
int which = 0;
1610
+ char * sawConversionError = NULL;
16111611
Stmt q;
16121612
if( !g.perm.Read ){
16131613
g.json.resultCode = FSL_JSON_E_DENIED;
16141614
return NULL;
16151615
}
@@ -1670,17 +1670,19 @@
16701670
cson_object_set(pay,"branches",listV);
16711671
while((SQLITE_ROW==db_step(&q))){
16721672
cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
16731673
if(v){
16741674
cson_array_append(list,v);
1675
- }else{
1676
- char * msg = mprintf("Column-to-json failed @ %s:%d",
1677
- __FILE__,__LINE__);
1678
- json_warn(FSL_JSON_W_COL_TO_JSON_FAILED,msg);
1679
- free(msg);
1675
+ }else if(!sawConversionError){
1676
+ sawConversionError = mprintf("Column-to-json failed @ %s:%d",
1677
+ __FILE__,__LINE__);
16801678
}
16811679
}
1680
+ if( sawConversionError ){
1681
+ json_warn(FSL_JSON_W_COL_TO_JSON_FAILED,sawConversionError);
1682
+ free(sawConversionError);
1683
+}
16821684
return payV;
16831685
}
16841686
16851687
/*
16861688
** Impl of /json/rebuild. Requires admin previleges.
16871689
--- src/json.c
+++ src/json.c
@@ -726,13 +726,10 @@
726 cson_value * objV = NULL;
727 cson_object * obj = NULL;
728 assert( (code>FSL_JSON_W_START)
729 && (code<FSL_JSON_W_END)
730 && "Invalid warning code.");
731 if( BITSET_GET(g.json.warnings.bitset,code) ){
732 return;
733 }
734 if(!g.json.warnings.v){
735 g.json.warnings.v = cson_value_new_array();
736 assert((NULL != g.json.warnings.v) && "Alloc error.");
737 g.json.warnings.a = cson_value_get_array(g.json.warnings.v);
738 json_gc_add("$WARNINGS",g.json.warnings.v,0);
@@ -746,11 +743,10 @@
746 /* FIXME: treat NULL msg as standard warning message for
747 the code, but we don't have those yet.
748 */
749 cson_object_set(obj,"text",cson_value_new_string(msg,strlen(msg)));
750 }
751 BITSET_SET(g.json.warnings.bitset,code);
752 }
753
754 /*
755 ** Splits zStr (which must not be NULL) into tokens separated by the
756 ** given separator character. If doDeHttp is true then each element
@@ -1305,24 +1301,27 @@
1305 ** object and this function will return pTgt. If pTgt is NULL then a
1306 ** new Array object is created and returned (owned by the
1307 ** caller). Each row of pStmt is converted to an Object and appended
1308 ** to the array.
1309 */
1310 static cson_value * json_stmt_to_array_of_obj(Stmt *pStmt,
1311 cson_value * pTgt){
1312 cson_value * v = pTgt ? pTgt : cson_value_new_array();
1313 cson_array * a = cson_value_get_array(pTgt ? pTgt : v);
 
1314 assert( NULL != a );
1315 while( (SQLITE_ROW==db_step(pStmt)) ){
1316 cson_value * row = cson_sqlite3_row_to_object(pStmt->pStmt);
1317 if(!row){
1318 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
1319 "Could not convert at least one result row to JSON." );
1320 continue;
1321 }
1322 cson_array_append(a, row);
1323 }
 
 
 
1324 return v;
1325 }
1326
1327 /*
1328 ** /json/version implementation.
@@ -1606,10 +1605,11 @@
1606 cson_object * pay;
1607 cson_value * listV;
1608 cson_array * list;
1609 char const * range = NULL;
1610 int which = 0;
 
1611 Stmt q;
1612 if( !g.perm.Read ){
1613 g.json.resultCode = FSL_JSON_E_DENIED;
1614 return NULL;
1615 }
@@ -1670,17 +1670,19 @@
1670 cson_object_set(pay,"branches",listV);
1671 while((SQLITE_ROW==db_step(&q))){
1672 cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
1673 if(v){
1674 cson_array_append(list,v);
1675 }else{
1676 char * msg = mprintf("Column-to-json failed @ %s:%d",
1677 __FILE__,__LINE__);
1678 json_warn(FSL_JSON_W_COL_TO_JSON_FAILED,msg);
1679 free(msg);
1680 }
1681 }
 
 
 
 
1682 return payV;
1683 }
1684
1685 /*
1686 ** Impl of /json/rebuild. Requires admin previleges.
1687
--- src/json.c
+++ src/json.c
@@ -726,13 +726,10 @@
726 cson_value * objV = NULL;
727 cson_object * obj = NULL;
728 assert( (code>FSL_JSON_W_START)
729 && (code<FSL_JSON_W_END)
730 && "Invalid warning code.");
 
 
 
731 if(!g.json.warnings.v){
732 g.json.warnings.v = cson_value_new_array();
733 assert((NULL != g.json.warnings.v) && "Alloc error.");
734 g.json.warnings.a = cson_value_get_array(g.json.warnings.v);
735 json_gc_add("$WARNINGS",g.json.warnings.v,0);
@@ -746,11 +743,10 @@
743 /* FIXME: treat NULL msg as standard warning message for
744 the code, but we don't have those yet.
745 */
746 cson_object_set(obj,"text",cson_value_new_string(msg,strlen(msg)));
747 }
 
748 }
749
750 /*
751 ** Splits zStr (which must not be NULL) into tokens separated by the
752 ** given separator character. If doDeHttp is true then each element
@@ -1305,24 +1301,27 @@
1301 ** object and this function will return pTgt. If pTgt is NULL then a
1302 ** new Array object is created and returned (owned by the
1303 ** caller). Each row of pStmt is converted to an Object and appended
1304 ** to the array.
1305 */
1306 cson_value * json_stmt_to_array_of_obj(Stmt *pStmt,
1307 cson_value * pTgt){
1308 cson_value * v = pTgt ? pTgt : cson_value_new_array();
1309 cson_array * a = cson_value_get_array(pTgt ? pTgt : v);
1310 char const * warnMsg = NULL;
1311 assert( NULL != a );
1312 while( (SQLITE_ROW==db_step(pStmt)) ){
1313 cson_value * row = cson_sqlite3_row_to_object(pStmt->pStmt);
1314 if(!row && !warnMsg){
1315 warnMsg = "Could not convert at least one result row to JSON.";
 
1316 continue;
1317 }
1318 cson_array_append(a, row);
1319 }
1320 if(warnMsg){
1321 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED, warnMsg );
1322 }
1323 return v;
1324 }
1325
1326 /*
1327 ** /json/version implementation.
@@ -1606,10 +1605,11 @@
1605 cson_object * pay;
1606 cson_value * listV;
1607 cson_array * list;
1608 char const * range = NULL;
1609 int which = 0;
1610 char * sawConversionError = NULL;
1611 Stmt q;
1612 if( !g.perm.Read ){
1613 g.json.resultCode = FSL_JSON_E_DENIED;
1614 return NULL;
1615 }
@@ -1670,17 +1670,19 @@
1670 cson_object_set(pay,"branches",listV);
1671 while((SQLITE_ROW==db_step(&q))){
1672 cson_value * v = cson_sqlite3_column_to_value(q.pStmt,0);
1673 if(v){
1674 cson_array_append(list,v);
1675 }else if(!sawConversionError){
1676 sawConversionError = mprintf("Column-to-json failed @ %s:%d",
1677 __FILE__,__LINE__);
 
 
1678 }
1679 }
1680 if( sawConversionError ){
1681 json_warn(FSL_JSON_W_COL_TO_JSON_FAILED,sawConversionError);
1682 free(sawConversionError);
1683 }
1684 return payV;
1685 }
1686
1687 /*
1688 ** Impl of /json/rebuild. Requires admin previleges.
1689
--- src/json_detail.h
+++ src/json_detail.h
@@ -20,13 +20,14 @@
2020
** value.
2121
**
2222
*/
2323
enum FossilJsonCodes {
2424
FSL_JSON_W_START = 0,
25
-FSL_JSON_W_ROW_TO_JSON_FAILED = FSL_JSON_W_START + 1,
26
-FSL_JSON_W_COL_TO_JSON_FAILED = FSL_JSON_W_START + 2,
27
-FSL_JSON_W_STRING_TO_ARRAY_FAILED = FSL_JSON_W_START + 3,
25
+FSL_JSON_W_UNKNOWN = FSL_JSON_W_START + 1,
26
+FSL_JSON_W_ROW_TO_JSON_FAILED = FSL_JSON_W_START + 2,
27
+FSL_JSON_W_COL_TO_JSON_FAILED = FSL_JSON_W_START + 3,
28
+FSL_JSON_W_STRING_TO_ARRAY_FAILED = FSL_JSON_W_START + 4,
2829
2930
FSL_JSON_W_END = 1000,
3031
FSL_JSON_E_GENERIC = 1000,
3132
FSL_JSON_E_GENERIC_SUB1 = FSL_JSON_E_GENERIC + 100,
3233
FSL_JSON_E_INVALID_REQUEST = FSL_JSON_E_GENERIC_SUB1 + 1,
3334
--- src/json_detail.h
+++ src/json_detail.h
@@ -20,13 +20,14 @@
20 ** value.
21 **
22 */
23 enum FossilJsonCodes {
24 FSL_JSON_W_START = 0,
25 FSL_JSON_W_ROW_TO_JSON_FAILED = FSL_JSON_W_START + 1,
26 FSL_JSON_W_COL_TO_JSON_FAILED = FSL_JSON_W_START + 2,
27 FSL_JSON_W_STRING_TO_ARRAY_FAILED = FSL_JSON_W_START + 3,
 
28
29 FSL_JSON_W_END = 1000,
30 FSL_JSON_E_GENERIC = 1000,
31 FSL_JSON_E_GENERIC_SUB1 = FSL_JSON_E_GENERIC + 100,
32 FSL_JSON_E_INVALID_REQUEST = FSL_JSON_E_GENERIC_SUB1 + 1,
33
--- src/json_detail.h
+++ src/json_detail.h
@@ -20,13 +20,14 @@
20 ** value.
21 **
22 */
23 enum FossilJsonCodes {
24 FSL_JSON_W_START = 0,
25 FSL_JSON_W_UNKNOWN = FSL_JSON_W_START + 1,
26 FSL_JSON_W_ROW_TO_JSON_FAILED = FSL_JSON_W_START + 2,
27 FSL_JSON_W_COL_TO_JSON_FAILED = FSL_JSON_W_START + 3,
28 FSL_JSON_W_STRING_TO_ARRAY_FAILED = FSL_JSON_W_START + 4,
29
30 FSL_JSON_W_END = 1000,
31 FSL_JSON_E_GENERIC = 1000,
32 FSL_JSON_E_GENERIC_SUB1 = FSL_JSON_E_GENERIC + 100,
33 FSL_JSON_E_INVALID_REQUEST = FSL_JSON_E_GENERIC_SUB1 + 1,
34
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -259,10 +259,12 @@
259259
cson_value * listV = NULL;
260260
cson_array * list = NULL;
261261
int check = 0;
262262
int showFiles = 0;
263263
Stmt q;
264
+ char warnRowToJsonFailed = 0;
265
+ char warnStringToArrayFailed = 0;
264266
Blob sql = empty_blob;
265267
if( !g.perm.Read/* && !g.perm.RdTkt && !g.perm.RdWiki*/ ){
266268
g.json.resultCode = FSL_JSON_E_DENIED;
267269
return NULL;
268270
}
@@ -314,11 +316,12 @@
314316
/* convert each row into a JSON object...*/
315317
int const rid = db_column_int(&q,0);
316318
cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
317319
cson_object * row = cson_value_get_object(rowV);
318320
cson_string const * tagsStr = NULL;
319
- if(!row){
321
+ if(!row && !warnRowToJsonFailed){
322
+ warnRowToJsonFailed = 1;
320323
json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
321324
"Could not convert at least one timeline result row to JSON." );
322325
continue;
323326
}
324327
/* Split tags string field into JSON Array... */
@@ -332,11 +335,12 @@
332335
cson_value_free(tags);
333336
}else{
334337
/*replaced/deleted old tags value, invalidating tagsStr*/;
335338
tagsStr = NULL;
336339
}
337
- }else{
340
+ }else if(!warnStringToArrayFailed){
341
+ warnStringToArrayFailed = 1;
338342
json_warn(FSL_JSON_W_STRING_TO_ARRAY_FAILED,
339343
"Could not convert tags string to array.");
340344
}
341345
}
342346
@@ -420,29 +424,11 @@
420424
-1);
421425
listV = cson_value_new_array();
422426
list = cson_value_get_array(listV);
423427
tmp = listV;
424428
SET("timeline");
425
- while( (SQLITE_ROW == db_step(&q) )){
426
- /* convert each row into a JSON object...*/
427
- cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
428
- cson_object * row = cson_value_get_object(rowV);
429
- int rc;
430
- if(!row){
431
- json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
432
- "Could not convert at least one timeline result row to JSON." );
433
- continue;
434
- }
435
- rc = cson_array_append( list, rowV );
436
- if( 0 != rc ){
437
- cson_value_free(rowV);
438
- g.json.resultCode = (cson_rc.AllocError==rc)
439
- ? FSL_JSON_E_ALLOC
440
- : FSL_JSON_E_UNKNOWN;
441
- goto error;
442
- }
443
- }
429
+ json_stmt_to_array_of_obj(&q, listV);
444430
#undef SET
445431
goto ok;
446432
error:
447433
assert( 0 != g.json.resultCode );
448434
cson_value_free(payV);
449435
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -259,10 +259,12 @@
259 cson_value * listV = NULL;
260 cson_array * list = NULL;
261 int check = 0;
262 int showFiles = 0;
263 Stmt q;
 
 
264 Blob sql = empty_blob;
265 if( !g.perm.Read/* && !g.perm.RdTkt && !g.perm.RdWiki*/ ){
266 g.json.resultCode = FSL_JSON_E_DENIED;
267 return NULL;
268 }
@@ -314,11 +316,12 @@
314 /* convert each row into a JSON object...*/
315 int const rid = db_column_int(&q,0);
316 cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
317 cson_object * row = cson_value_get_object(rowV);
318 cson_string const * tagsStr = NULL;
319 if(!row){
 
320 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
321 "Could not convert at least one timeline result row to JSON." );
322 continue;
323 }
324 /* Split tags string field into JSON Array... */
@@ -332,11 +335,12 @@
332 cson_value_free(tags);
333 }else{
334 /*replaced/deleted old tags value, invalidating tagsStr*/;
335 tagsStr = NULL;
336 }
337 }else{
 
338 json_warn(FSL_JSON_W_STRING_TO_ARRAY_FAILED,
339 "Could not convert tags string to array.");
340 }
341 }
342
@@ -420,29 +424,11 @@
420 -1);
421 listV = cson_value_new_array();
422 list = cson_value_get_array(listV);
423 tmp = listV;
424 SET("timeline");
425 while( (SQLITE_ROW == db_step(&q) )){
426 /* convert each row into a JSON object...*/
427 cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
428 cson_object * row = cson_value_get_object(rowV);
429 int rc;
430 if(!row){
431 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
432 "Could not convert at least one timeline result row to JSON." );
433 continue;
434 }
435 rc = cson_array_append( list, rowV );
436 if( 0 != rc ){
437 cson_value_free(rowV);
438 g.json.resultCode = (cson_rc.AllocError==rc)
439 ? FSL_JSON_E_ALLOC
440 : FSL_JSON_E_UNKNOWN;
441 goto error;
442 }
443 }
444 #undef SET
445 goto ok;
446 error:
447 assert( 0 != g.json.resultCode );
448 cson_value_free(payV);
449
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -259,10 +259,12 @@
259 cson_value * listV = NULL;
260 cson_array * list = NULL;
261 int check = 0;
262 int showFiles = 0;
263 Stmt q;
264 char warnRowToJsonFailed = 0;
265 char warnStringToArrayFailed = 0;
266 Blob sql = empty_blob;
267 if( !g.perm.Read/* && !g.perm.RdTkt && !g.perm.RdWiki*/ ){
268 g.json.resultCode = FSL_JSON_E_DENIED;
269 return NULL;
270 }
@@ -314,11 +316,12 @@
316 /* convert each row into a JSON object...*/
317 int const rid = db_column_int(&q,0);
318 cson_value * rowV = cson_sqlite3_row_to_object(q.pStmt);
319 cson_object * row = cson_value_get_object(rowV);
320 cson_string const * tagsStr = NULL;
321 if(!row && !warnRowToJsonFailed){
322 warnRowToJsonFailed = 1;
323 json_warn( FSL_JSON_W_ROW_TO_JSON_FAILED,
324 "Could not convert at least one timeline result row to JSON." );
325 continue;
326 }
327 /* Split tags string field into JSON Array... */
@@ -332,11 +335,12 @@
335 cson_value_free(tags);
336 }else{
337 /*replaced/deleted old tags value, invalidating tagsStr*/;
338 tagsStr = NULL;
339 }
340 }else if(!warnStringToArrayFailed){
341 warnStringToArrayFailed = 1;
342 json_warn(FSL_JSON_W_STRING_TO_ARRAY_FAILED,
343 "Could not convert tags string to array.");
344 }
345 }
346
@@ -420,29 +424,11 @@
424 -1);
425 listV = cson_value_new_array();
426 list = cson_value_get_array(listV);
427 tmp = listV;
428 SET("timeline");
429 json_stmt_to_array_of_obj(&q, listV);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430 #undef SET
431 goto ok;
432 error:
433 assert( 0 != g.json.resultCode );
434 cson_value_free(payV);
435
+4 -13
--- src/main.c
+++ src/main.c
@@ -217,16 +217,10 @@
217217
cson_object * o;
218218
} reqPayload; /* request payload object (if any) */
219219
struct { /* response warnings */
220220
cson_value * v;
221221
cson_array * a;
222
- int bitset[FSL_JSON_W_END/8/sizeof(int)+1]
223
- /* allows json_add_warning() to know if a given warning
224
- has been set or not (we don't produce dupes, to simplify
225
- downstream loop logic).
226
- */
227
- ;
228222
} warnings;
229223
} json;
230224
};
231225
232226
/*
@@ -518,26 +512,23 @@
518512
519513
/* Print a warning message */
520514
void fossil_warning(const char *zFormat, ...){
521515
char *z;
522516
va_list ap;
523
- if( g.json.isJsonMode ){
524
- /* The JSON API has no way of dealing with warnings and
525
- outputing them here will corrupt the output.
526
- */
527
- return;
528
- }
529517
va_start(ap, zFormat);
530518
z = vmprintf(zFormat, ap);
531519
va_end(ap);
532
- if( g.cgiOutput ){
520
+ if(g.json.isJsonMode){
521
+ json_warn( FSL_JSON_W_UNKNOWN, z );
522
+ }else if( g.cgiOutput ){
533523
cgi_printf("<p class=\"generalError\">%h</p>", z);
534524
}else{
535525
char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
536526
fossil_puts(zOut, 1);
537527
free(zOut);
538528
}
529
+ free(z);
539530
}
540531
541532
/*
542533
** Malloc and free routines that cannot fail
543534
*/
544535
--- src/main.c
+++ src/main.c
@@ -217,16 +217,10 @@
217 cson_object * o;
218 } reqPayload; /* request payload object (if any) */
219 struct { /* response warnings */
220 cson_value * v;
221 cson_array * a;
222 int bitset[FSL_JSON_W_END/8/sizeof(int)+1]
223 /* allows json_add_warning() to know if a given warning
224 has been set or not (we don't produce dupes, to simplify
225 downstream loop logic).
226 */
227 ;
228 } warnings;
229 } json;
230 };
231
232 /*
@@ -518,26 +512,23 @@
518
519 /* Print a warning message */
520 void fossil_warning(const char *zFormat, ...){
521 char *z;
522 va_list ap;
523 if( g.json.isJsonMode ){
524 /* The JSON API has no way of dealing with warnings and
525 outputing them here will corrupt the output.
526 */
527 return;
528 }
529 va_start(ap, zFormat);
530 z = vmprintf(zFormat, ap);
531 va_end(ap);
532 if( g.cgiOutput ){
 
 
533 cgi_printf("<p class=\"generalError\">%h</p>", z);
534 }else{
535 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
536 fossil_puts(zOut, 1);
537 free(zOut);
538 }
 
539 }
540
541 /*
542 ** Malloc and free routines that cannot fail
543 */
544
--- src/main.c
+++ src/main.c
@@ -217,16 +217,10 @@
217 cson_object * o;
218 } reqPayload; /* request payload object (if any) */
219 struct { /* response warnings */
220 cson_value * v;
221 cson_array * a;
 
 
 
 
 
 
222 } warnings;
223 } json;
224 };
225
226 /*
@@ -518,26 +512,23 @@
512
513 /* Print a warning message */
514 void fossil_warning(const char *zFormat, ...){
515 char *z;
516 va_list ap;
 
 
 
 
 
 
517 va_start(ap, zFormat);
518 z = vmprintf(zFormat, ap);
519 va_end(ap);
520 if(g.json.isJsonMode){
521 json_warn( FSL_JSON_W_UNKNOWN, z );
522 }else if( g.cgiOutput ){
523 cgi_printf("<p class=\"generalError\">%h</p>", z);
524 }else{
525 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
526 fossil_puts(zOut, 1);
527 free(zOut);
528 }
529 free(z);
530 }
531
532 /*
533 ** Malloc and free routines that cannot fail
534 */
535

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button