Commit Graph

11 Commits

Author SHA1 Message Date
riastradh
d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
christos
e5e66fc581 use sizeof(*var) instead of sizeof(type) 2017-11-04 01:52:09 +00:00
macallan
6743ac6be4 make glyph caches reconfigurable 2017-06-02 19:30:10 +00:00
chs
fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
pooka
d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
macallan
86e9be6a98 try not to crash when calling glyphcache_wipe() on an uninitialized cache
first step to fix PR 48492
2014-01-13 19:30:33 +00:00
macallan
9622d8acf1 glyphcache_init(): bail if we don't have enough off-screen memory to be useful 2012-11-13 20:29:03 +00:00
macallan
f952894398 allow caching of glyphs with attributes other than the default
while there, also add support for underlined characters
2012-10-04 10:26:32 +00:00
macallan
4de7bc18ac deal with negative cache sizes 2012-07-12 01:21:08 +00:00
macallan
4d3aa5644d no need to convert cell number to coordinates every time we draw a glyph
from cache - just stick the coordinates directly into the map
2012-04-19 08:46:17 +00:00
macallan
e297db4b59 generic support for caching glyphs in video memory
for speeding up anti-aliased fonts on slow CPUs
2012-02-16 17:29:21 +00:00