linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux/macros.h(new) and linux/list.h(mod) ...
@ 2001-07-05 20:57 Davide Libenzi
  2001-07-05 21:31 ` David Woodhouse
  2001-07-05 22:03 ` Kai Germaschewski
  0 siblings, 2 replies; 22+ messages in thread
From: Davide Libenzi @ 2001-07-05 20:57 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]


This patch add a new linux/macros.h that is supposed to host utility macros
that otherwise developers are forced to define in their files.
This version contain only min(), max() and abs().
The other change is to linux/list.h by adding two members list_first() and
list_last().




- Davide


[-- Attachment #2: misc.diff --]
[-- Type: application/octet-stream, Size: 1077 bytes --]

diff -NBbru linux-2.4.6.vanilla/include/linux/list.h linux-2.4.6/include/linux/list.h
--- linux-2.4.6.vanilla/include/linux/list.h	Fri Feb 16 16:06:17 2001
+++ linux-2.4.6/include/linux/list.h	Mon Jul  2 16:14:27 2001
@@ -148,6 +148,10 @@
  */
 #define list_for_each(pos, head) \
 	for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define list_first(head)	(((head)->next != (head)) ? (head)->next: (struct list_head *) 0)
+
+#define list_last(head)	(((head)->prev != (head)) ? (head)->prev: (struct list_head *) 0)

 #endif /* __KERNEL__ || _LVM_H_INCLUDE */

diff -NBbru linux-2.4.6.vanilla/include/linux/macros.h linux-2.4.6/include/linux/macros.h
--- linux-2.4.6.vanilla/include/linux/macros.h	Wed Dec 31 16:00:00 1969
+++ linux-2.4.6/include/linux/macros.h	Wed Jul  4 16:41:31 2001
@@ -0,0 +1,19 @@
+#ifndef _LINUX_MACROS_H
+#define _LINUX_MACROS_H
+
+
+#ifndef min
+#define min(a, b)	(((a) < (b)) ? (a): (b))
+#endif
+
+#ifndef max
+#define max(a, b)	(((a) > (b)) ? (a): (b))
+#endif
+
+#ifndef abs
+#define abs(a)	(((a) > 0) ? (a): -(a))
+#endif
+
+
+
+#endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2001-07-06 22:02 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-05 20:57 linux/macros.h(new) and linux/list.h(mod) Davide Libenzi
2001-07-05 21:31 ` David Woodhouse
2001-07-05 21:45   ` Davide Libenzi
2001-07-05 21:54     ` Hua Zhong
2001-07-05 21:58       ` David Woodhouse
2001-07-05 22:20         ` Hua Zhong
2001-07-05 22:06       ` Davide Libenzi
2001-07-05 22:10     ` J . A . Magallon
2001-07-05 22:33     ` Daniel Phillips
2001-07-05 22:43     ` David Woodhouse
2001-07-05 22:53       ` Davide Libenzi
2001-07-05 23:23         ` J . A . Magallon
2001-07-05 22:57       ` Alan Cox
2001-07-05 23:05         ` Matthew Dharm
2001-07-05 23:07           ` Alan Cox
2001-07-05 23:08         ` David Woodhouse
2001-07-06  1:51           ` Arnaldo Carvalho de Melo
2001-07-05 23:21         ` Davide Libenzi
     [not found]           ` <0107060149080M.03760@starship>
2001-07-05 23:54             ` Daniel Phillips
2001-07-06 17:38         ` Neil Booth
2001-07-06 22:02           ` Arnaldo Carvalho de Melo
2001-07-05 22:03 ` Kai Germaschewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).