2
0

File holds data.

This commit is contained in:
Maarten Billemont 2019-07-25 12:52:22 -04:00
parent 9833f02339
commit fc1e86f0ca
2 changed files with 5 additions and 5 deletions

View File

@ -99,7 +99,7 @@ MPMarshalledQuestion *mpw_marshal_question(
} }
MPMarshalledFile *mpw_marshal_file( MPMarshalledFile *mpw_marshal_file(
MPMarshalledUser *user) { MPMarshalledUser *user, MPMarshalledData *data) {
MPMarshalledFile *file; MPMarshalledFile *file;
if (!user || !(file = malloc( sizeof( MPMarshalledFile ) ))) if (!user || !(file = malloc( sizeof( MPMarshalledFile ) )))
@ -107,8 +107,8 @@ MPMarshalledFile *mpw_marshal_file(
*file = (MPMarshalledFile){ *file = (MPMarshalledFile){
.info = NULL, .info = NULL,
.data = NULL,
.user = user, .user = user,
.data = data,
}; };
return file; return file;
} }
@ -770,7 +770,7 @@ static MPMarshalledFile *mpw_marshal_read_flat(
mpw_free_strings( &fullName, &keyID, NULL ); mpw_free_strings( &fullName, &keyID, NULL );
mpw_free( &masterKey, MPMasterKeySize ); mpw_free( &masterKey, MPMasterKeySize );
MPMarshalledFile *file = mpw_marshal_file( user ); MPMarshalledFile *file = mpw_marshal_file( user, NULL );
if (!file) { if (!file) {
*error = (MPMarshalError){ MPMarshalErrorInternal, "Couldn't allocate a new marshal file." }; *error = (MPMarshalError){ MPMarshalErrorInternal, "Couldn't allocate a new marshal file." };
mpw_marshal_user_free( &user ); mpw_marshal_user_free( &user );
@ -1018,7 +1018,7 @@ static MPMarshalledFile *mpw_marshal_read_json(
mpw_free( &masterKey, MPMasterKeySize ); mpw_free( &masterKey, MPMasterKeySize );
json_object_put( json_file ); json_object_put( json_file );
MPMarshalledFile *file = mpw_marshal_file( user ); MPMarshalledFile *file = mpw_marshal_file( user, NULL );
if (!file) { if (!file) {
*error = (MPMarshalError){ MPMarshalErrorInternal, "Couldn't allocate a new marshal file." }; *error = (MPMarshalError){ MPMarshalErrorInternal, "Couldn't allocate a new marshal file." };
mpw_marshal_user_free( &user ); mpw_marshal_user_free( &user );

View File

@ -179,7 +179,7 @@ MPMarshalledQuestion *mpw_marshal_question(
/** Create a new file to marshal a user into. /** Create a new file to marshal a user into.
* @return A file object (allocated), or NULL if the user is missing or the marshalled file couldn't be allocated. */ * @return A file object (allocated), or NULL if the user is missing or the marshalled file couldn't be allocated. */
MPMarshalledFile *mpw_marshal_file( MPMarshalledFile *mpw_marshal_file(
MPMarshalledUser *user); MPMarshalledUser *user, MPMarshalledData *data);
/** Free the given user object and all associated data. */ /** Free the given user object and all associated data. */
bool mpw_marshal_info_free( bool mpw_marshal_info_free(