2 ms·
But the coding styles in the Linux kernel usually maintain a single exit point from the function. The format they generally have is: syscall(params) {
by scott_s 16y ago
But the coding styles in the Linux kernel usually maintain a single exit point from the function. The format they generally have is:
syscall(params)
{
if (easy check on params fails)
goto done;
allocate data for work
if (further check on params and data fails)
goto cleanup;
perform real work
cleanup:
deallocate data
done:
set return value
}
There's often still a single exit, but it does use gotos to implement simple exceptions. The only times when there are multiple exits is before any data has been allocated and there's no cleanup to be done.