Commit Graph

28 Commits

Author SHA1 Message Date
Hisham b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Explorer09 6dae8108f8 Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses.
With the CLAMP macro replacing the combination of MIN and MAX, we will
have at least two advantages:
1. It's more obvious semantically.
2. There are no more mixes of confusing uses like MIN(MAX(a,b),c) and
   MAX(MIN(a,b),c) and MIN(a,MAX(b,c)) appearing everywhere. We unify
   the 'clamping' with a single macro.
Note that the behavior of this CLAMP macro is different from
the combination `MAX(low,MIN(x,high))`.
* This CLAMP macro expands to two comparisons instead of three from
  MAX and MIN combination. In theory, this makes the code slightly
  smaller, in case that (low) or (high) or both are computed at
  runtime, so that compilers cannot optimize them. (The third
  comparison will matter if (low)>(high); see below.)
* CLAMP has a side effect, that if (low)>(high) it will produce weird
  results. Unlike MIN & MAX which will force either (low) or (high) to
  win. No assertion of ((low)<=(high)) is done in this macro, for now.

This CLAMP macro is implemented like described in glib
<http://developer.gnome.org/glib/stable/glib-Standard-Macros.html>
and does not handle weird uses like CLAMP(a++, low++, high--) .
2016-01-15 20:26:01 +08:00
Michael Klein cc23d13f87 Add Platform_getProcessEnv
- currently implemented for darwin and linux
2015-12-03 22:23:40 +01:00
Hisham Muhammad 71190654bc Calculate CPU averages on Darwin (See #295). 2015-10-23 13:46:21 -02:00
Martin "eto" Misuth 93f05b459f fixed broken merge, where I forgot to check linux/Platform.c so that it matches upstream 2015-10-06 20:05:55 +02:00
Martin "eto" Misuth 2379835910 Added platform dependent DEFAULT_SIGNAL define, for now for:
FreeBSD
Linux
Other platforms will have it undefined for now.
2015-10-06 14:04:22 +02:00
Hisham Muhammad 3fe2f3e28e Move list of signals to platform-specific code.
Implementations for Linux (tested) and FreeBSD (still untested, thanks to @etosan for providing the table).
Darwin and OpenBSD(ping @mmcco) builds should be broken now, pending their own tables.
2015-10-06 03:02:49 -03:00
Christian Hesse 08829cbc3b fix compiler warnings
gcc gives warnings like this:

warning: ignoring return value of ‘fscanf’, declared with attribute
warn_unused_result

Assign value to a variable, cast to (void) to discard it.
2015-05-15 11:33:25 +02:00
Hisham Muhammad d0c72c3fb2 Move FunctionBar inside Panel 2015-03-23 15:26:56 -03:00
Hisham Muhammad 272e2d9b34 Major advances in FreeBSD port. 2015-03-16 23:02:03 -03:00
Hisham Muhammad 7fd4af80ff Linux build fixes. 2015-03-16 03:25:43 -03:00
Hisham Muhammad 5c8b83405b Merge branch 'master' into wip
Conflicts:
	Process.c
	Process.h
	linux/LinuxProcess.c
	linux/LinuxProcess.h
	linux/LinuxProcessList.c
	unsupported/Platform.c
	unsupported/Platform.h
2015-03-16 03:22:33 -03:00
Hisham Muhammad be1700cf94 Isolate portable and Linux-specific process fields. 2015-03-16 01:43:04 -03:00
Hisham Muhammad e3fe3962cb Move more Linux-specific code into Linux subdir. 2015-03-15 20:29:13 -03:00
Hisham Muhammad 50000d808e Silence warnings reported in #70. 2015-02-23 03:34:06 -03:00
Hisham Muhammad 9780c312f4 Fix allocation of processes. Closes #166.
Conflicts:
	Process.c
	Process.h
	ProcessList.c
	ScreenManager.c
	linux/LinuxProcessList.c
2015-02-23 01:13:40 -03:00
Hisham Muhammad 6f868b00c0 Fix allocation of processes. Closes #166. 2015-02-20 14:52:10 -02:00
Hisham Muhammad c2108e5a48 Another mega-patch for the refactoring process.
Kinda runs, but functionality from the original main loop
is still missing. Patience.
2015-01-23 03:08:21 -02:00
Hisham Muhammad 3383d8e556 Sorry about the mega-patch.
This is a work-in-progress, code is currently broken.
(Some actions, and notably, the header, are missing.)
2015-01-21 23:27:31 -02:00
Hisham Muhammad 430c7c9a9b Move platform-dependent parts of Linux battery meter. 2014-11-27 21:04:57 -02:00
Hisham Muhammad b4f6b11092 Move "get max pid" code into platform specific area. 2014-11-27 20:10:23 -02:00
Hisham Muhammad 5578a316f0 Merge branch 'master' of https://github.com/hishamhm/htop 2014-11-27 19:58:07 -02:00
Hisham Muhammad 529095607c Isolate cross-platform code for load average. 2014-11-27 19:57:24 -02:00
Hisham Muhammad e748401588 Build fix. 2014-11-27 19:46:01 -02:00
Hisham Muhammad ca03094bb2 Make UptimeMeter cross-platform again. 2014-11-27 19:41:14 -02:00
Hisham Muhammad 357e7a3243 Move UptimeMeter into platform-dependent area.
Set up environment to move other meters.
2014-11-27 19:18:14 -02:00
Hisham Muhammad aaaaf063a1 Builds on Linux again! 2014-11-24 19:22:50 -02:00
Hisham Muhammad 26422af608 Files moved and added for supporting separate platforms. 2014-11-24 18:55:49 -02:00