215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
struct {
cson_value * v;
cson_object * o;
} reqPayload; /* request payload object (if any) */
struct { /* response warnings */
cson_value * v;
cson_array * a;
int bitset[FSL_JSON_W_END/8/sizeof(int)+1]
/* allows json_add_warning() to know if a given warning
has been set or not (we don't produce dupes, to simplify
downstream loop logic).
*/
;
} warnings;
} json;
};
/*
** Macro for debugging:
*/
|
<
<
<
<
<
<
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
struct {
cson_value * v;
cson_object * o;
} reqPayload; /* request payload object (if any) */
struct { /* response warnings */
cson_value * v;
cson_array * a;
} warnings;
} json;
};
/*
** Macro for debugging:
*/
|
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
}
/* Print a warning message */
void fossil_warning(const char *zFormat, ...){
char *z;
va_list ap;
if( g.json.isJsonMode ){
/* The JSON API has no way of dealing with warnings and
outputing them here will corrupt the output.
*/
return;
}
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
fossil_puts(zOut, 1);
free(zOut);
}
}
/*
** Malloc and free routines that cannot fail
*/
void *fossil_malloc(size_t n){
void *p = malloc(n==0 ? 1 : n);
|
<
<
<
<
<
<
>
>
|
>
|
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
|
}
/* Print a warning message */
void fossil_warning(const char *zFormat, ...){
char *z;
va_list ap;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if(g.json.isJsonMode){
json_warn( FSL_JSON_W_UNKNOWN, z );
}else if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
fossil_puts(zOut, 1);
free(zOut);
}
free(z);
}
/*
** Malloc and free routines that cannot fail
*/
void *fossil_malloc(size_t n){
void *p = malloc(n==0 ? 1 : n);
|