Chameleon

Chameleon Commit Details

Date:2011-06-25 00:08:26 (12 years 9 months ago)
Author:Azimutz
Commit:1053
Parents: 1052
Message:Remove "extra" definitions of min/max; convert remaining to MIN/MAX. Leaving "external" definitions untouched.
Changes:
M/trunk/i386/boot2/graphics.c
M/trunk/i386/libsaio/saio_types.h
M/trunk/i386/libsaio/msdos.c
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsaio/cpu.c
M/trunk/i386/libsaio/disk.c
M/trunk/i386/libsaio/ext2fs.c
M/trunk/i386/boot2/options.c
M/trunk/i386/libsaio/sys.c
M/trunk/i386/util/fdisk/cmd.c
M/trunk/i386/libsaio/load.c
M/trunk/i386/libsa/qsort.c

File differences

trunk/i386/libsaio/ext2fs.c
3737
3838
3939
40
40
4141
4242
return;
}
str[strMaxLen]=0;
strncpy (str, buf+0x478, min (strMaxLen, 16));
strncpy (str, buf+0x478, MIN(strMaxLen, 16));
free (buf);
}
trunk/i386/libsaio/sys.c
451451
452452
453453
454
454
455455
456456
457457
if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) {
continue;
}
io->i_buf = max(iob[i].i_filesize + iob[i].i_buf, io->i_buf);
io->i_buf = MAX(iob[i].i_filesize + iob[i].i_buf, io->i_buf);
}
// Load entire file into memory. Unnecessary open() calls must be avoided.
trunk/i386/libsaio/load.c
151151
152152
153153
154
155
154
155
156156
157157
158158
case LC_SEGMENT:
ret = DecodeSegment(cmdBase, &load_addr, &load_size);
if (ret == 0 && load_size != 0 && load_addr >= KERNEL_ADDR) {
vmaddr = min(vmaddr, load_addr);
vmend = max(vmend, load_addr + load_size);
vmaddr = MIN(vmaddr, load_addr);
vmend = MAX(vmend, load_addr + load_size);
}
break;
trunk/i386/libsaio/cpu.c
5656
5757
5858
59
59
6060
6161
6262
......
170170
171171
172172
173
173
174174
175175
176176
*/
if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = min(tscDelta, (tscEnd - tscStart))
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if( (tscEnd - tscStart) < tscDelta )
tscDelta = tscEnd - tscStart;
}
strlcpy(p->CPU.BrandString,s, sizeof(p->CPU.BrandString));
if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, min(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) {
if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, MIN(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) {
/*
* This string means we have a firmware-programmable brand string,
* and the firmware couldn't figure out what sort of CPU we have.
trunk/i386/libsaio/disk.c
17661766
17671767
17681768
1769
1769
17701770
17711771
17721772
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncat(str, aliasStart, min(strMaxLen, aliasLen));
strncat(str, aliasStart, MIN(strMaxLen, aliasLen));
free(aliasList);
return true;
trunk/i386/libsaio/saio_types.h
233233
234234
235235
236
237
236
237
238
239
240
241
242
238243
239
240
241
244
245
242246
243247
248
244249
245250
246251
247
252
248253
249254
250255
DEV_EN = 3
};
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
/*
* min/max Macros.
*
* Azi: defined on <sys/param.h>, i386/include/IOKit/IOLib.h (min/max, lower case), and others...
*/
#ifndef MIN
#defineMIN(a,b) ( ((a) < (b)) ? (a) : (b) )
#endif
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#ifndef MAX
#defineMAX(a,b) ( ((a) > (b)) ? (a) : (b) )
#endif
/*Azi: not used
#defineround2(x, m)(((x) + (m / 2)) & ~(m - 1))
#define roundup2(x, m) (((x) + m - 1) & ~(m - 1))
#define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p)
#define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p)*/
enum {
kNetworkDeviceType = kBIOSDevTypeNetwork,
trunk/i386/libsaio/msdos.c
4545
4646
4747
48
48
4949
5050
51
5251
5352
5453
......
6059
6160
6261
62
63
6364
6465
6566
......
767768
768769
769770
770
771
771772
772773
773
774
774775
775776
776777
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c))
#include "libsaio.h"
#include "sl.h"
#include "msdos_private.h"
#include "msdos.h"
#defineCLUST_RSRVD160xfff8/* reserved cluster range */
#defineCLUST_RSRVD120xff8/* reserved cluster range */
#define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c))
static int msdosressector=0;
static int msdosnfats = 0;
static int msdosfatsecs = 0;
if (length==0 || length>size-offset)
toread=size-offset;
wastoread=toread;
bcopy (buf+(offset%msdosclustersize),ptr,min(msdosclustersize-(offset%msdosclustersize), toread));
bcopy (buf+(offset%msdosclustersize),ptr,MIN(msdosclustersize-(offset%msdosclustersize), toread));
ptr+=msdosclustersize-(offset%msdosclustersize);
toread-=msdosclustersize-(offset%msdosclustersize);
while (toread>0 && msdosreadcluster (ih, (uint8_t *)ptr, min(msdosclustersize,toread), &cluster))
while (toread>0 && msdosreadcluster (ih, (uint8_t *)ptr, MIN(msdosclustersize,toread), &cluster))
{
ptr+=msdosclustersize;
toread-=msdosclustersize;
trunk/i386/boot2/graphics.c
4242
4343
4444
45
46
4745
4846
4947
uint8_t *previewSaveunder = 0;
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define MIN(x, y) ((x) < (y) ? (x) : (y))
//==========================================================================
// getVBEInfoString
trunk/i386/boot2/gui.c
2222
2323
2424
25
26
27
2825
2926
3027
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define vram VIDEO(baseAddr)
trunk/i386/boot2/options.c
322322
323323
324324
325
325
326326
327327
328328
329
329
330330
331331
332332
......
899899
900900
901901
902
902
903903
904904
905905
......
10241024
10251025
10261026
1027
1027
10281028
10291029
10301030
gMenuHeight= height;
gMenuItemCount= count;
gMenuTop= 0;
gMenuBottom= min( count, height ) - 1;
gMenuBottom= MIN( count, height ) - 1;
gMenuSelection= selection;
gMenuStart= 0;
gMenuEnd = min( count, gui.maxdevices ) - 1;
gMenuEnd = MIN( count, gui.maxdevices ) - 1;
// If the selected item is not visible, shift the list down.
printf("Use \30\31 keys to select the startup volume.");
}
showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems );
nextRow += min( gDeviceCount, kMenuMaxItems ) + 3;
nextRow += MIN( gDeviceCount, kMenuMaxItems ) + 3;
}
// Show the boot prompt.
if (gDeviceCount) {
printf("Use \30\31 keys to select the startup volume.");
showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems);
nextRow += min(gDeviceCount, kMenuMaxItems) + 3;
nextRow += MIN(gDeviceCount, kMenuMaxItems) + 3;
}
showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
trunk/i386/libsa/qsort.c
5757
5858
5959
60
6061
6162
6263
6364
64
65
6665
6766
6867
......
178177
179178
180179
181
180
182181
183
182
184183
185184
186185
#include <sys/types.h>
#include <stdlib.h>
#include "saio_types.h" //Azi: MIN/MAX
static inline char*med3 __P((char *, char *, char *, int (*)()));
static inline void swapfunc __P((char *, char *, int, int));
#define min(a, b)(a) < (b) ? a : b
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
*/
}
pn = a + n * es;
r = min(pa - (char *)a, pb - pa);
r = MIN(pa - (char *)a, pb - pa);
vecswap(a, pb - r, r);
r = min(pd - pc, (pn - pd) - (int)es);
r = MIN(pd - pc, (pn - pd) - (int)es);
vecswap(pb, pn - r, r);
if ((r = pb - pa) > (int)es)
qsort(a, r / es, es, cmp);
trunk/i386/util/fdisk/cmd.c
6565
6666
6767
68
6869
6970
7071
#include "part.h"
#include "cmd.h"
#include "auto.h"
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
int

Archive Download the corresponding diff file

Revision: 1053