Skip to content

Commit

Permalink
mkm: match Rust Option type naming
Browse files Browse the repository at this point in the history
  • Loading branch information
septract committed Jan 3, 2025
1 parent 59e7337 commit aa65423
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions components/include/cn_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ ensures
/*$
datatype OptionMemory {
SomeMemory {{u64 base, u64 size} al, map<u64, u8> bu},
NothingMemory {}
NoneMemory {}
}
predicate (datatype OptionMemory) MallocResult(pointer p, u64 n)
{
if (is_null(p)) {
return NothingMemory {};
return NoneMemory {};
} else {
take log = Alloc(p);
assert(allocs[(alloc_id)p] == log);
Expand Down
10 changes: 5 additions & 5 deletions components/mission_key_management/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,24 @@ requires ValidState( state );
/*$
datatype OptionClientObject {
SomeClientObject {struct client obj},
NothingClientObject {}
NoneClientObject {}
}
predicate (OptionClientObject) MaybeClientNew(pointer p, i32 fd, i32 state)
predicate (OptionClientObject) OptionClientNew(pointer p, i32 fd, i32 state)
{
if (is_null(p)) {
return NothingClientObject {};
return NoneClientObject {};
} else {
take Client_out = ClientObject(p);
assert(Client_out.fd == fd);
assert(((i32) Client_out.state) == state);
return SomeClientObject { obj: Client_out} ;
return SomeClientObject { obj: Client_out } ;
}
}
$*/

struct client* client_new(int fd)
/*$
ensures take Client_out = MaybeClientNew(return, fd, CS_RECV_KEY_ID);
ensures take Client_out = OptionClientNew(return, fd, CS_RECV_KEY_ID);
$*/
{
struct client* c = malloc(sizeof(struct client));
Expand Down

0 comments on commit aa65423

Please sign in to comment.