summaryrefslogtreecommitdiff
path: root/cpp.c
AgeCommit message (Collapse)AuthorFilesLines
2016-04-26cpp: Use mkstemps() to create unique temporary fileTobias Klauser1-4/+9
Use mkstemps() to safely create a unique temporary file instead of using rand() to manually create a (potentially unsafe) temporary filename. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-29cpp: Fix sparse warningTobias Klauser1-0/+1
Include cpp.h for the prototype of cpp_exec() in order to fix the following sparse warning: cpp.c:18:5: warning: symbol 'cpp_exec' was not declared. Should it be static? Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17cpp: Constify cpp argv passed to cpp_execTobias Klauser1-2/+2
Pass argv as char *const argv[] as execvp expects it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17cpp: Allow to pass additional cpp optionsVadim Kochan1-9/+30
Extend cpp_exec function with args parameter to specify additional cpp options (like -D). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17cpp: Use new proc_exec function to invoke cppVadim Kochan1-5/+10
Replace 'system' call by proc_exec function from proc.c module. It allows to easy extend cpp invoking with additional options (like -D) in more secure way. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-24cpp: Use /tmp folder for output filesVadim Kochan1-8/+5
There might be a case when input file is located in read-only directory and cpp fails when it tries to create output file there, so use /tmp folder for that as usually it should be writeable for any user. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-24cpp: Add cpp.c module to invoke C preprocessorVadim Kochan1-0/+27
Add cpp_exec func to invoke C preprocessor which allow to change the logic in one place only. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>