From fe394e0baab11f80a5e432784ed52e8542869413 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 29 Apr 2008 13:20:46 +0000 Subject: [PATCH] Avoid in-function #if directives. * src/parthelper.c [!PED_PARTITION_PROTECTED]: Define to 0. Remove in-function #ifdefs. --- ChangeLog | 6 ++++++ src/parthelper.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec4cd95dbf..8be63b814c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Apr 29 15:20:12 CEST 2008 Jim Meyering + + Avoid in-function #if directives. + * src/parthelper.c [!PED_PARTITION_PROTECTED]: Define to 0. + Remove in-function #ifdefs. + Tue Apr 29 09:15:00 BST 2008 Richard W.M. Jones * src/parthelper.c: Don't fail if PED_PARTITION_PROTECTED diff --git a/src/parthelper.c b/src/parthelper.c index a0fe241639..1cd72402d3 100644 --- a/src/parthelper.c +++ b/src/parthelper.c @@ -35,6 +35,12 @@ #include #include +/* Make the comparisons below fail if your parted headers + are so old that they lack the definition. */ +#ifndef PED_PARTITION_PROTECTED +# define PED_PARTITION_PROTECTED 0 +#endif + int main(int argc, char **argv) { PedDevice *dev; @@ -67,10 +73,8 @@ int main(int argc, char **argv) content = "free"; else if (part->type & PED_PARTITION_METADATA) content = "metadata"; -#ifdef PED_PARTITION_PROTECTED else if (part->type & PED_PARTITION_PROTECTED) content = "protected"; -#endif else content = "data"; } else if (part->type == PED_PARTITION_EXTENDED) { @@ -82,10 +86,8 @@ int main(int argc, char **argv) content = "free"; else if (part->type & PED_PARTITION_METADATA) content = "metadata"; -#ifdef PED_PARTITION_PROTECTED else if (part->type & PED_PARTITION_PROTECTED) content = "protected"; -#endif else content = "data"; }