diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-17 21:14:43 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-17 21:14:43 +0800 |
commit | f86b8cf32e528fc67aaab054034d86fe4fabfcb8 (patch) | |
tree | 9e1a1f701a3162edf105bd736d0271691a30484e | |
parent | bf980ec24237ca6de9767757ed21697430c7d7d6 (diff) | |
download | pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar.gz pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar.bz2 pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar.lz pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar.xz pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.tar.zst pttbbs-f86b8cf32e528fc67aaab054034d86fe4fabfcb8.zip |
- improve from_ip sort style
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4316 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/shmctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/shmctl.c b/util/shmctl.c index 4a1a2a4c..e50fef43 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -280,8 +280,12 @@ cmputmpidle(const void * i, const void * j) static int cmputmpfrom(const void * i, const void * j) { - // desc sorted - return -(SHM->uinfo[*(int*)i].from_ip - SHM->uinfo[*(int*)j].from_ip); + int r = strcmp(SHM->uinfo[*(int*)i].from, SHM->uinfo[*(int*)j].from); + if (r) return r; + + // *** from_ip (in_addr_t) is big endian network number. + return memcmp(&(SHM->uinfo[*(int*)i].from_ip), &(SHM->uinfo[*(int*)j].from_ip), + sizeof(SHM->uinfo[0].from_ip)); } static int |