| 
									
										
										
										
											2013-07-28 12:17:00 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __BLI_ALLOCA_H__
 | 
					
						
							| 
									
										
										
										
											2013-09-19 23:17:52 +00:00
										 |  |  | #define __BLI_ALLOCA_H__
 | 
					
						
							| 
									
										
										
										
											2013-07-28 12:17:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup bli | 
					
						
							| 
									
										
										
										
											2013-07-28 12:17:00 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Defines alloca and utility macro BLI_array_alloca | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* BLI_array_alloca / alloca */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(__GNUC__) || defined(__clang__)
 | 
					
						
							| 
									
										
										
										
											2015-08-12 22:17:27 +02:00
										 |  |  | #if defined(__cplusplus) && (__cplusplus > 199711L)
 | 
					
						
							|  |  |  | #define BLI_array_alloca(arr, realsize) \
 | 
					
						
							|  |  |  | 	(decltype(arr))alloca(sizeof(*arr) * (realsize)) | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2013-07-28 12:17:00 +00:00
										 |  |  | #define BLI_array_alloca(arr, realsize) \
 | 
					
						
							|  |  |  | 	(typeof(arr))alloca(sizeof(*arr) * (realsize)) | 
					
						
							| 
									
										
										
										
											2015-08-12 22:17:27 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-07-28 12:17:00 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | #define BLI_array_alloca(arr, realsize) \
 | 
					
						
							|  |  |  | 	alloca(sizeof(*arr) * (realsize)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* __BLI_ALLOCA_H__ */
 |