Changeset 88712ad5e512167bcebb1e7e2aed736aead24078

Show
Ignore:
Timestamp:
10/11/11 03:46:59 (20 months ago)
Author:
Nedko Arnaudov <nedko@…>
Children:
6df7809837f5abf82df57c6f8cc01f41b2837648
Parents:
8ba2d5f991a2236ede2ccaed237bfb2baae6badd
git-author:
Nedko Arnaudov <nedko@arnaudov.name> / 2011-10-11T03:46:18Z+0300
git-committer:
Nedko Arnaudov <nedko@arnaudov.name> / 2011-10-11T03:46:59Z+0300
Message:

simplify ladish_room_save_project() error handling

the callback is always called. the function has not return value anymore.

Location:
daemon
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • daemon/room.h

    r5483a52 r88712ad  
    8989typedef void (* ladish_room_save_complete_callback)(void * context, bool success); 
    9090 
    91 bool 
     91void 
    9292ladish_room_save_project( 
    9393  ladish_room_handle room_handle, 
  • daemon/room_save.c

    r5483a52 r88712ad  
    317317#undef ctx_ptr 
    318318 
    319 static bool ladish_room_save_project_do(struct ladish_room_save_context * ctx_ptr) 
     319static void ladish_room_save_project_do(struct ladish_room_save_context * ctx_ptr) 
    320320{ 
    321321  log_info("Saving project '%s' in room '%s' to '%s'", ctx_ptr->room->project_name, ctx_ptr->room->name, ctx_ptr->room->project_dir); 
     
    325325  if (!ensure_dir_exist(ctx_ptr->room->project_dir, 0777)) 
    326326  { 
    327     goto fail; 
     327    ladish_room_save_complete(ctx_ptr, false); 
    328328  } 
    329329 
    330330  ladish_app_supervisor_save(ctx_ptr->room->app_supervisor, ctx_ptr, ladish_room_apps_save_complete); 
    331  
    332   return true; 
    333  
    334 fail: 
    335   ladish_room_save_complete(ctx_ptr, false); 
    336   return false; 
    337331} 
    338332 
     
    363357#define room_ptr ((struct ladish_room *)room_handle) 
    364358 
    365 bool 
     359void 
    366360ladish_room_save_project( 
    367361  ladish_room_handle room_handle, 
     
    384378  { 
    385379    log_error("malloc() failed to allocate memory for room save context struct"); 
    386     goto fail; 
     380    ctx_ptr->callback(ctx_ptr->context, false); 
     381    return; 
    387382  } 
    388383 
     
    472467  room_ptr->project_dir = ctx_ptr->project_dir; 
    473468 
    474   return ladish_room_save_project_do(ctx_ptr); 
     469  ladish_room_save_project_do(ctx_ptr); 
     470  return; 
    475471 
    476472destroy_ctx: 
    477   ladish_room_save_context_destroy(ctx_ptr); 
    478 fail: 
    479   return false; 
     473  ladish_room_save_complete(ctx_ptr, false); 
    480474} 
    481475