extern int attrlayer_save(int flags) { static t_elist *curr = &dirtylist; static t_elist *next = NULL; t_attrgroup *attrgroup; unsigned int scount; unsigned int tcount; scount = tcount = 0; if (curr == &dirtylist || FLAG_ISSET(flags, FS_ALL)) { curr = elist_next(&dirtylist); next = elist_next(curr); } /* elist_for_each_safe splitted into separate startup for userstep function */ for (; curr != &dirtylist; curr = next, next = elist_next(curr)) { if (!FLAG_ISSET(flags, FS_ALL) && tcount >= prefs_get_user_step()) break; attrgroup = elist_entry(curr, t_attrgroup, dirtylist); switch (attrgroup_save(attrgroup, flags)) { case 0: /* stop on the first account not saved (ie dirty too early) */ goto loopout; case 1: scount++; break; case -1: eventlog(eventlog_level_error, __FUNCTION__, "could not save account"); break; default: break; } tcount++; } loopout: if (scount > 0) eventlog(eventlog_level_debug, __FUNCTION__, "saved %u user accounts", scount); if (!FLAG_ISSET(flags, FS_ALL) && curr != &dirtylist) return 1; return 0; }
extern int account_save(t_account * account, unsigned flags) { assert(account); return attrgroup_save(account->attrgroup, flags); }