Signed-off-by: Karel Zak <kzak@redhat.com>
{
int rc;
- assert(cxt);
-
if (!cxt || !cxt->label)
return 0;
size_t i, n;
int *c;
- assert(cxt);
-
- if (!lb)
- lb = cxt->label;
- if (!lb)
+ if (!cxt || (!lb && !cxt->label))
return -EINVAL;
+
+ lb = cxt->label;
if (!lb->fields || !lb->nfields)
return -ENOSYS;
c = calloc(lb->nfields, sizeof(int));
size_t i, n;
int *c;
- assert(cxt);
-
- if (!lb)
- lb = cxt->label;
- if (!lb)
+ if (!cxt || (!lb && !cxt->label))
return -EINVAL;
+
+ lb = cxt->label;
if (!lb->fields || !lb->nfields)
return -ENOSYS;
c = calloc(lb->nfields, sizeof(int));
struct fdisk_context *cxt,
size_t *n)
{
- assert(cxt);
- assert(n);
+ if (!cxt || !n)
+ return -EINVAL;
if (pa && pa->partno_follow_default) {
size_t i;
{
int rc;
- assert(cxt);
- assert(cxt->label);
-
if (!cxt || !cxt->label)
return -EINVAL;
if (!cxt->label->op->add_part)
{
struct fdisk_scriptheader *fi;
- assert(dp);
- assert(name);
-
if (!dp || !name)
return -EINVAL;
-
fi = script_get_header(dp, name);
if (!fi && !data)
return 0; /* want to remove header that does not exist, success */
int rc;
char *p = NULL;
- assert(dp);
+ if (!dp || (!cxt && !dp->cxt))
+ return -EINVAL;
if (!cxt)
cxt = dp->cxt;
- if (!dp || !cxt)
- return -EINVAL;
-
DBG(SCRIPT, ul_debugobj(dp, "reading context into script"));
fdisk_reset_script(dp);
{
int rc = 1;
- assert(tb);
- assert(itr);
- assert(pa);
-
if (!tb || !itr || !pa)
return -EINVAL;
*pa = NULL;
*/
int fdisk_table_add_partition(struct fdisk_table *tb, struct fdisk_partition *pa)
{
- assert(tb);
- assert(pa);
-
if (!tb || !pa)
return -EINVAL;
*/
int fdisk_table_remove_partition(struct fdisk_table *tb, struct fdisk_partition *pa)
{
- assert(tb);
- assert(pa);
-
if (!tb || !pa)
return -EINVAL;