return NO if forgetting did not work because it was already forgotten earlier
This commit is contained in:
parent
684a234264
commit
5f268913dd
@ -215,7 +215,9 @@ TALER_JSON_contract_mark_forgettable (json_t *json,
|
|||||||
*
|
*
|
||||||
* @param[in,out] json some JSON object to modify
|
* @param[in,out] json some JSON object to modify
|
||||||
* @param field name of the field to forget
|
* @param field name of the field to forget
|
||||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
* @return #GNUNET_OK on success,
|
||||||
|
* #GNUNET_NO if the field was already forgotten before
|
||||||
|
* #GNUNET_SYSERR on error
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TALER_JSON_contract_part_forget (json_t *json,
|
TALER_JSON_contract_part_forget (json_t *json,
|
||||||
|
@ -445,6 +445,37 @@ TALER_JSON_contract_part_forget (json_t *json,
|
|||||||
field);
|
field);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
rx = json_object_get (json,
|
||||||
|
"_forgotten");
|
||||||
|
if (NULL == rx)
|
||||||
|
{
|
||||||
|
rx = json_object ();
|
||||||
|
if (0 !=
|
||||||
|
json_object_set_new (json,
|
||||||
|
"_forgotten",
|
||||||
|
rx))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (NULL !=
|
||||||
|
json_object_get (rx,
|
||||||
|
field))
|
||||||
|
{
|
||||||
|
if (! json_is_null (json_object_get (json,
|
||||||
|
field)))
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
|
"Field `%s' market as forgotten, but still exists!\n",
|
||||||
|
field);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
|
"Already forgot field `%s'\n",
|
||||||
|
field);
|
||||||
|
return GNUNET_NO;
|
||||||
|
}
|
||||||
salt = json_string_value (json_object_get (fg,
|
salt = json_string_value (json_object_get (fg,
|
||||||
field));
|
field));
|
||||||
if (NULL == salt)
|
if (NULL == salt)
|
||||||
@ -482,20 +513,6 @@ TALER_JSON_contract_part_forget (json_t *json,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx = json_object_get (json,
|
|
||||||
"_forgotten");
|
|
||||||
if (NULL == rx)
|
|
||||||
{
|
|
||||||
rx = json_object ();
|
|
||||||
if (0 !=
|
|
||||||
json_object_set_new (json,
|
|
||||||
"_forgotten",
|
|
||||||
rx))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* remember field as 'forgotten' */
|
/* remember field as 'forgotten' */
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_object_set_new (rx,
|
json_object_set_new (rx,
|
||||||
|
Loading…
Reference in New Issue
Block a user