diff options
| author | Neil Hodgson <nyamatongwe@gmail.com> | 2014-01-21 09:45:29 +1100 | 
|---|---|---|
| committer | Neil Hodgson <nyamatongwe@gmail.com> | 2014-01-21 09:45:29 +1100 | 
| commit | 2bd8a54e0624143ee5128d1e224b1635b2c5d1f4 (patch) | |
| tree | 6acd5402304cd8f9efc400d11ca32dab95d5410d /lexlib/StringCopy.h | |
| parent | 56d581a730cd2c5dd0959c6b3bd532c9f5ad42e2 (diff) | |
| download | scintilla-mirror-2bd8a54e0624143ee5128d1e224b1635b2c5d1f4.tar.gz | |
Added ELEMENTS macro and use it to clarify determining size of arrays.
Diffstat (limited to 'lexlib/StringCopy.h')
| -rw-r--r-- | lexlib/StringCopy.h | 3 | 
1 files changed, 3 insertions, 0 deletions
diff --git a/lexlib/StringCopy.h b/lexlib/StringCopy.h index caca49911..1812b4e35 100644 --- a/lexlib/StringCopy.h +++ b/lexlib/StringCopy.h @@ -1,6 +1,7 @@  // Scintilla source code edit control  /** @file StringCopy.h   ** Safe string copy function which always NUL terminates. + ** ELEMENTS macro for determining array sizes.   **/  // Copyright 2013 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed. @@ -26,6 +27,8 @@ void StringCopy(T (&dest)[count], const T* source) {  	dest[count-1] = 0;  } +#define ELEMENTS(a) (sizeof(a) / sizeof(a[0])) +  #ifdef SCI_NAMESPACE  }  #endif  | 
