Fossil SCM

terribly minor internal cleanups.

stephan 2011-09-18 19:16 UTC json
Commit 507a4582777c6bd69ced50d9499ce112b02d3bac
1 file changed +6 -4
+6 -4
--- src/json.c
+++ src/json.c
@@ -38,13 +38,15 @@
3838
** Holds keys used for various JSON API properties.
3939
*/
4040
static const struct FossilJsonKeys_{
4141
char const * authToken;
4242
char const * commandPath;
43
+ char const * anonymousSeed;
4344
} FossilJsonKeys = {
4445
"authToken" /*authToken*/,
45
- "COMMAND_PATH" /*commandPath*/
46
+ "COMMAND_PATH" /*commandPath*/,
47
+ "anonymousSeed" /*anonymousSeed*/
4648
};
4749
4850
/*
4951
** Given a FossilJsonCodes value, it returns a string suitable for use
5052
** as a resultText string. Returns some unspecified string if errCode
@@ -958,14 +960,14 @@
958960
enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
959961
80-digit number.
960962
*/
961963
};
962964
static char seedBuffer[SeedBufLen];
963
- cson_value const * jseed = json_getenv("anonymousSeed");
965
+ cson_value const * jseed = json_getenv(FossilJsonKeys.anonymousSeed);
964966
seedBuffer[0] = 0;
965967
if( !jseed ){
966
- jseed = json_payload_property("anonymousSeed");
968
+ jseed = json_payload_property(FossilJsonKeys.anonymousSeed);
967969
if( !jseed ){
968970
jseed = json_getenv("cs") /* name used by HTML interface */;
969971
}
970972
}
971973
if(jseed){
@@ -1012,11 +1014,11 @@
10121014
}else{
10131015
login_set_user_cookie(name, uid, &cookie);
10141016
}
10151017
payload = cookie
10161018
? cson_value_new_string( cookie, strlen(cookie) )
1017
- : cson_value_null();
1019
+ : cson_value_null()/*why null instead of NULL?*/;
10181020
free(cookie);
10191021
return payload;
10201022
}
10211023
#endif
10221024
}
10231025
--- src/json.c
+++ src/json.c
@@ -38,13 +38,15 @@
38 ** Holds keys used for various JSON API properties.
39 */
40 static const struct FossilJsonKeys_{
41 char const * authToken;
42 char const * commandPath;
 
43 } FossilJsonKeys = {
44 "authToken" /*authToken*/,
45 "COMMAND_PATH" /*commandPath*/
 
46 };
47
48 /*
49 ** Given a FossilJsonCodes value, it returns a string suitable for use
50 ** as a resultText string. Returns some unspecified string if errCode
@@ -958,14 +960,14 @@
958 enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
959 80-digit number.
960 */
961 };
962 static char seedBuffer[SeedBufLen];
963 cson_value const * jseed = json_getenv("anonymousSeed");
964 seedBuffer[0] = 0;
965 if( !jseed ){
966 jseed = json_payload_property("anonymousSeed");
967 if( !jseed ){
968 jseed = json_getenv("cs") /* name used by HTML interface */;
969 }
970 }
971 if(jseed){
@@ -1012,11 +1014,11 @@
1012 }else{
1013 login_set_user_cookie(name, uid, &cookie);
1014 }
1015 payload = cookie
1016 ? cson_value_new_string( cookie, strlen(cookie) )
1017 : cson_value_null();
1018 free(cookie);
1019 return payload;
1020 }
1021 #endif
1022 }
1023
--- src/json.c
+++ src/json.c
@@ -38,13 +38,15 @@
38 ** Holds keys used for various JSON API properties.
39 */
40 static const struct FossilJsonKeys_{
41 char const * authToken;
42 char const * commandPath;
43 char const * anonymousSeed;
44 } FossilJsonKeys = {
45 "authToken" /*authToken*/,
46 "COMMAND_PATH" /*commandPath*/,
47 "anonymousSeed" /*anonymousSeed*/
48 };
49
50 /*
51 ** Given a FossilJsonCodes value, it returns a string suitable for use
52 ** as a resultText string. Returns some unspecified string if errCode
@@ -958,14 +960,14 @@
960 enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
961 80-digit number.
962 */
963 };
964 static char seedBuffer[SeedBufLen];
965 cson_value const * jseed = json_getenv(FossilJsonKeys.anonymousSeed);
966 seedBuffer[0] = 0;
967 if( !jseed ){
968 jseed = json_payload_property(FossilJsonKeys.anonymousSeed);
969 if( !jseed ){
970 jseed = json_getenv("cs") /* name used by HTML interface */;
971 }
972 }
973 if(jseed){
@@ -1012,11 +1014,11 @@
1014 }else{
1015 login_set_user_cookie(name, uid, &cookie);
1016 }
1017 payload = cookie
1018 ? cson_value_new_string( cookie, strlen(cookie) )
1019 : cson_value_null()/*why null instead of NULL?*/;
1020 free(cookie);
1021 return payload;
1022 }
1023 #endif
1024 }
1025

Keyboard Shortcuts

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