Fossil SCM
terribly minor internal cleanups.
Commit
507a4582777c6bd69ced50d9499ce112b02d3bac
Parent
5f3a98ae83057a2…
1 file changed
+6
-4
+6
-4
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -38,13 +38,15 @@ | ||
| 38 | 38 | ** Holds keys used for various JSON API properties. |
| 39 | 39 | */ |
| 40 | 40 | static const struct FossilJsonKeys_{ |
| 41 | 41 | char const * authToken; |
| 42 | 42 | char const * commandPath; |
| 43 | + char const * anonymousSeed; | |
| 43 | 44 | } FossilJsonKeys = { |
| 44 | 45 | "authToken" /*authToken*/, |
| 45 | - "COMMAND_PATH" /*commandPath*/ | |
| 46 | + "COMMAND_PATH" /*commandPath*/, | |
| 47 | + "anonymousSeed" /*anonymousSeed*/ | |
| 46 | 48 | }; |
| 47 | 49 | |
| 48 | 50 | /* |
| 49 | 51 | ** Given a FossilJsonCodes value, it returns a string suitable for use |
| 50 | 52 | ** as a resultText string. Returns some unspecified string if errCode |
| @@ -958,14 +960,14 @@ | ||
| 958 | 960 | enum { SeedBufLen = 100 /* in some JSON tests i once actually got an |
| 959 | 961 | 80-digit number. |
| 960 | 962 | */ |
| 961 | 963 | }; |
| 962 | 964 | static char seedBuffer[SeedBufLen]; |
| 963 | - cson_value const * jseed = json_getenv("anonymousSeed"); | |
| 965 | + cson_value const * jseed = json_getenv(FossilJsonKeys.anonymousSeed); | |
| 964 | 966 | seedBuffer[0] = 0; |
| 965 | 967 | if( !jseed ){ |
| 966 | - jseed = json_payload_property("anonymousSeed"); | |
| 968 | + jseed = json_payload_property(FossilJsonKeys.anonymousSeed); | |
| 967 | 969 | if( !jseed ){ |
| 968 | 970 | jseed = json_getenv("cs") /* name used by HTML interface */; |
| 969 | 971 | } |
| 970 | 972 | } |
| 971 | 973 | if(jseed){ |
| @@ -1012,11 +1014,11 @@ | ||
| 1012 | 1014 | }else{ |
| 1013 | 1015 | login_set_user_cookie(name, uid, &cookie); |
| 1014 | 1016 | } |
| 1015 | 1017 | payload = cookie |
| 1016 | 1018 | ? cson_value_new_string( cookie, strlen(cookie) ) |
| 1017 | - : cson_value_null(); | |
| 1019 | + : cson_value_null()/*why null instead of NULL?*/; | |
| 1018 | 1020 | free(cookie); |
| 1019 | 1021 | return payload; |
| 1020 | 1022 | } |
| 1021 | 1023 | #endif |
| 1022 | 1024 | } |
| 1023 | 1025 |
| --- 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 |