NTSTATUS DoSomething()
{
NSTATUS Status;
...
Status = NtXXX();
if (!NT_SUCCESS(Status))
goto done;
Status = NtYYY();
if (!NT_SUCCESS(Status))
goto cleanXXX;
Status = NtZZZ();
if (!NT_SUCCESS(Status))
goto cleanYYY;
cleanZZZ:
cleanupZZZ();
cleanYYY:
cleanupYYY();
cleanXXX:
cleanupXXX();
done:
return Status;
}Thomas
NTSTATUS DoSomething()
{
NSTATUS Status = NtXXX();
if (NT_SUCCESS(Status)) {
Status = NtYYY();
if (!NT_SUCCESS(Status))
cleanupXXX();
Status = NtZZZ();
if (!NT_SUCCESS(Status))
cleanupYYY();
}
return Status;
}
i think thats the most simple and easy to read
but in the end is´ent it not a littel waste of time
discusse old functions their need rewrite anyway..?
Thomas
Show replies by date