From 4c77fe50d97a773e32a4756c79dade3adbb6a601 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 30 Apr 1998 17:35:59 +0000 Subject: [PATCH] ChangeLog, e2fsck.h, pass1.c, super.c: pass1.c (process_inode_cmp): Use EXT2_QSORT_TYPE to define the appropriate return type for comparison functions for qsort. e2fsck.h: Add #ifdef protection for unistd.h super.c: Remove header files already included by e2fsck.h ChangeLog, dblist.c, ext2fs.h: ext2fs.h: Define EXT2_QSORT_TYPE appropriately for the return type for comparison functions for qsort. dblist.c (dir_block_cmp): Use EXT2_QSORT_TYPE in function declaration. ChangeLog, extent.c: extent.c (ext2fs_create_extent_table): Use ext2fs_free_mem instead of free(). (extent_cmp): Use EXT2_QSORT_TYPE to define the appropriate return type for comparison functions for qsort. --- e2fsck/ChangeLog | 9 +++++++++ e2fsck/e2fsck.h | 2 ++ e2fsck/pass1.c | 4 ++-- e2fsck/super.c | 13 ------------- lib/ext2fs/ChangeLog | 8 ++++++++ lib/ext2fs/dblist.c | 4 ++-- lib/ext2fs/ext2fs.h | 9 +++++++++ resize/ChangeLog | 7 +++++++ resize/extent.c | 4 ++-- 9 files changed, 41 insertions(+), 19 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 298385e..e0a8e00 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,12 @@ +1998-04-28 Theodore Ts'o + + * pass1.c (process_inode_cmp): Use EXT2_QSORT_TYPE to define the + appropriate return type for comparison functions for qsort. + + * e2fsck.h: Add #ifdef protection for unistd.h + + * super.c: Remove header files already included by e2fsck.h + 1998-04-26 Theodore Ts'o * dirinfo.c (e2fsck_add_dir_info): Update function to pass the old diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index efb7549..a3e3e58 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -8,7 +8,9 @@ #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include #ifdef HAVE_SYS_TYPES_H diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 2e258d4..3efe086 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -62,7 +62,7 @@ static void alloc_bad_map(e2fsck_t ctx); static void alloc_bb_map(e2fsck_t ctx); static void handle_fs_bad_blocks(e2fsck_t ctx); static void process_inodes(e2fsck_t ctx, char *block_buf); -static int process_inode_cmp(const void *a, const void *b); +static EXT2_QSORT_TYPE process_inode_cmp(const void *a, const void *b); static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan, dgrp_t group, void * priv_data); /* static char *describe_illegal_block(ext2_filsys fs, blk_t block); */ @@ -592,7 +592,7 @@ static void process_inodes(e2fsck_t ctx, char *block_buf) ehandler_operation(old_operation); } -static int process_inode_cmp(const void *a, const void *b) +static EXT2_QSORT_TYPE process_inode_cmp(const void *a, const void *b) { const struct process_inode_block *ib_a = (const struct process_inode_block *) a; diff --git a/e2fsck/super.c b/e2fsck/super.c index 62038be..f5dc7f2 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -9,22 +9,9 @@ * %End-Header% */ -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#ifdef HAVE_GETOPT_H -#include -#endif -#include #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_MNTENT_H -#include -#endif #ifndef EXT2_SKIP_UUID #include "uuid/uuid.h" diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 9fcb3ce..80e054a 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,11 @@ +1998-04-28 Theodore Ts'o + + * ext2fs.h: Define EXT2_QSORT_TYPE appropriately for the + return type for comparison functions for qsort. + + * dblist.c (dir_block_cmp): Use EXT2_QSORT_TYPE in function + declaration. + 1998-04-26 Theodore Ts'o * ext2fs.h, bitops.h: Add support for the Watcom C compiler to do diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 9683ef1..b636584 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -25,7 +25,7 @@ #include "ext2fsP.h" -static int dir_block_cmp(const void *a, const void *b); +static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b); /* * Returns the number of directories in the filesystem as reported by @@ -234,7 +234,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, } -static int dir_block_cmp(const void *a, const void *b) +static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b) { const struct ext2_db_entry *db_a = (const struct ext2_db_entry *) a; diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index 6c84517..83ca4df 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -66,6 +66,15 @@ typedef __s64 blkcnt_t; #include "ext2fs/ext2_err.h" #endif +/* + * Portability help for Microsoft Visual C++ + */ +#ifdef _MSC_VER +#define EXT2_QSORT_TYPE int __cdecl +#else +#define EXT2_QSORT_TYPE int +#endif + typedef struct struct_ext2_filsys *ext2_filsys; struct ext2fs_struct_generic_bitmap { diff --git a/resize/ChangeLog b/resize/ChangeLog index 4b85202..1a632fb 100644 --- a/resize/ChangeLog +++ b/resize/ChangeLog @@ -1,3 +1,10 @@ +1998-04-28 Theodore Ts'o + + * extent.c (ext2fs_create_extent_table): Use ext2fs_free_mem + instead of free(). + (extent_cmp): Use EXT2_QSORT_TYPE to define the appropriate + return type for comparison functions for qsort. + 1998-04-26 Theodore Ts'o * resize2fs.c (adjust_superblock): diff --git a/resize/extent.c b/resize/extent.c index b583baa..dbd6022 100644 --- a/resize/extent.c +++ b/resize/extent.c @@ -49,7 +49,7 @@ errcode_t ext2fs_create_extent_table(ext2_extent *ret_extent, int size) retval = ext2fs_get_mem(sizeof(struct ext2_extent_entry) * extent->size, (void **) &extent->list); if (retval) { - free(extent); + ext2fs_free_mem((void **) &extent); return retval; } memset(extent->list, 0, @@ -121,7 +121,7 @@ errcode_t ext2fs_add_extent_entry(ext2_extent extent, __u32 old_loc, __u32 new_l /* * Helper function for qsort */ -static int extent_cmp(const void *a, const void *b) +static EXT2_QSORT_TYPE extent_cmp(const void *a, const void *b) { const struct ext2_extent_entry *db_a; const struct ext2_extent_entry *db_b; -- 1.8.3.1