From: Martin Mares Date: Mon, 13 Sep 1999 09:19:34 +0000 (+0000) Subject: Killed `typedef unsigned long ulg' and replaced all refs to ulg by either X-Git-Tag: holmes-import~1667 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b8d8a4e155bcb5d793450b3e6002ea6d41786513;p=libucw.git Killed `typedef unsigned long ulg' and replaced all refs to ulg by either u32 or (newly introduced) oid_t type (object ID). --- diff --git a/lib/config.h b/lib/config.h index 613949b5..171211c6 100644 --- a/lib/config.h +++ b/lib/config.h @@ -1,7 +1,7 @@ /* * Sherlock Library -- Configuration-Dependent Definitions * - * (c) 1997, 1998 Martin Mares, + * (c) 1997--1999 Martin Mares, */ #ifndef _SHERLOCK_CONFIG_H @@ -19,8 +19,6 @@ typedef unsigned short word; /* exactly 16 bits, unsigned */ typedef short sword; /* exactly 16 bits, signed */ typedef unsigned short u16; /* exactly 16 bits, unsigned */ typedef short s16; /* exactly 16 bits, signed */ -typedef unsigned int ulg; /* exactly 32 bits, unsigned */ -typedef int slg; /* exactly 32 bits, signed */ typedef unsigned int u32; /* exactly 32 bits, unsigned */ typedef int s32; /* exactly 32 bits, signed */ typedef unsigned int uns; /* at least 32 bits */ @@ -32,6 +30,8 @@ typedef unsigned long addr_int_t; /* Both integer and address */ #define NULL (void *)0 #endif +typedef u32 oid_t; /* Object ID */ + /* CPU characteristics */ #define CPU_LITTLE_ENDIAN diff --git a/lib/fastbuf.c b/lib/fastbuf.c index d9ec1243..d420b3c9 100644 --- a/lib/fastbuf.c +++ b/lib/fastbuf.c @@ -169,9 +169,9 @@ word bgetw_slow(struct fastbuf *f) #endif } -ulg bgetl_slow(struct fastbuf *f) +u32 bgetl_slow(struct fastbuf *f) { - ulg l = bgetc_slow(f); + u32 l = bgetc_slow(f); #ifdef CPU_BIG_ENDIAN l = (l << 8) | bgetc_slow(f); l = (l << 8) | bgetc_slow(f); @@ -194,7 +194,7 @@ void bputw_slow(struct fastbuf *f, word w) #endif } -void bputl_slow(struct fastbuf *f, ulg l) +void bputl_slow(struct fastbuf *f, u32 l) { #ifdef CPU_BIG_ENDIAN bputc_slow(f, l >> 24); diff --git a/lib/fastbuf.h b/lib/fastbuf.h index ba9c42c5..3bc2b72f 100644 --- a/lib/fastbuf.h +++ b/lib/fastbuf.h @@ -80,15 +80,15 @@ extern inline word bgetw(struct fastbuf *f) return bgetw_slow(f); } -ulg bgetl_slow(struct fastbuf *f); -extern inline ulg bgetl(struct fastbuf *f) +u32 bgetl_slow(struct fastbuf *f); +extern inline u32 bgetl(struct fastbuf *f) { - ulg l; + u32 l; if (f->bptr + 4 <= f->bstop) { byte *p = f->bptr; #ifdef CPU_CAN_DO_UNALIGNED_LONGS - l = * ((ulg *) p); + l = * ((u32 *) p); #else #ifdef CPU_BIG_ENDIAN l = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; @@ -126,14 +126,14 @@ extern inline void bputw(struct fastbuf *f, word w) bputw_slow(f, w); } -void bputl_slow(struct fastbuf *f, ulg l); -extern inline void bputl(struct fastbuf *f, ulg l) +void bputl_slow(struct fastbuf *f, u32 l); +extern inline void bputl(struct fastbuf *f, u32 l) { if (f->bptr + 4 <= f->bufend) { byte *p = f->bptr; #ifdef CPU_CAN_DO_UNALIGNED_LONGS - * ((ulg *) p) = l; + * ((u32 *) p) = l; #else #ifdef CPU_BIG_ENDIAN p[0] = l >> 24U; diff --git a/lib/lib.h b/lib/lib.h index e6ffb2b6..9b169d7a 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -21,7 +21,7 @@ struct tempfile { void open_temp(struct tempfile *, byte *); void delete_temp(struct tempfile *); -ulg temprand(uns); +u32 temprand(uns); #define TF_GENERIC "t" #define TF_QUEUE_CONTROL "c" @@ -79,7 +79,7 @@ int match_ct_filter(struct ct_filter *, byte *); /* Binary log */ -int log2(ulg); +int log2(u32); /* obj.c */ @@ -114,9 +114,9 @@ struct oattr *prepend_attr(struct odes *, uns, byte *); #define OID_MIN 0x10000 /* Values less than this have special meaning */ -ulg new_oid(uns); -void mk_obj_name(byte *, ulg, byte *); -int dump_obj_to_file(byte *, ulg, struct odes *, int); +oid_t new_oid(uns); +void mk_obj_name(byte *, oid_t, byte *); +int dump_obj_to_file(byte *, oid_t, struct odes *, int); /* wordsplit.c */ @@ -156,7 +156,7 @@ int rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen); /* objwalk.c */ -void scan_obj_tree(byte *, void (*)(ulg, byte *)); +void scan_obj_tree(byte *, void (*)(oid_t, byte *)); /* random.c */ diff --git a/lib/log2.c b/lib/log2.c index 3cd98335..5ba25776 100644 --- a/lib/log2.c +++ b/lib/log2.c @@ -11,9 +11,9 @@ #undef log2 int -log2(ulg x) +log2(u32 x) { - ulg l; + uns l; if (!x) return 0; diff --git a/lib/temp.c b/lib/temp.c index 32a6529b..0b754c10 100644 --- a/lib/temp.c +++ b/lib/temp.c @@ -11,11 +11,11 @@ #include "lib.h" -ulg +u32 temprand(uns key) { static int seeded = 0; - ulg rand; + u32 rand; if (!seeded) {