Move MAX and MIN macros to macros.h

vim.h is too big, and these were missing parens around the arguments.
These may already be defined in <sys/param.h> or <windef.h>, so guard
them with an #ifndef.

extracted from #810
This commit is contained in:
Michael Reed 2015-08-25 21:10:17 -04:00
parent 7c135b8ccb
commit 2b39453912
2 changed files with 7 additions and 3 deletions

View File

@ -12,6 +12,13 @@
* macros.h: macro definitions for often used code
*/
#ifndef MIN
# define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
#endif
#ifndef MAX
# define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#endif
/*
* Position comparisons
*/

View File

@ -8,9 +8,6 @@
#ifndef NVIM_VIM_H
#define NVIM_VIM_H
#define MIN(X, Y) (X < Y ? X : Y)
#define MAX(X, Y) (X > Y ? X : Y)
#include "nvim/types.h"
#include "nvim/pos.h" // for linenr_T, MAXCOL, etc...