summaryrefslogtreecommitdiff
path: root/cpp.c
blob: 7739f0f8ca1f68674eeed87a0626fd2fdc59ac50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>

#include "cpp.h"
#include "str.h"
#include "proc.h"
#include "xmalloc.h"

static size_t argv_len(char *const argv[])
{
	size_t len = 0;

	for (; argv && *argv; argv++)
		len++;

	return len;
}

int cpp_exec(char *in_file, char *out_file, size_t out_len, char *const argv[])
{
	size_t argc = 7 + argv_len(argv);
	char *tmp = xstrdup(in_file);
	char **cpp_argv;
	int fd, ret = -1;
	char *base;
	unsigned int i = 0;

	base = basename(tmp);
	slprintf(out_file, out_len, "/tmp/.tmp-XXXXXX-%s", base);
	fd = mkstemps(out_file, strlen(base) + 1);
	if (fd < 0)
		goto err;

	cpp_argv = xmalloc(argc * sizeof(char *));

	cpp_argv[i++] = "cpp";

	for (; argv && *argv; argv++, i++)
		cpp_argv[i] = *argv;

	cpp_argv[i++] = "-I";
	cpp_argv[i++] = ETCDIRE_STRING;
	cpp_argv[i++] = "-o";
	cpp_argv[i++] = out_file;
	cpp_argv[i++] = in_file;
	cpp_argv[i++] = NULL;

	ret = proc_exec("cpp", cpp_argv);
	close(fd);

	xfree(cpp_argv);
err:
	xfree(tmp);
	return ret;
}
entation/kobject.txt?h=nds-private-remove&id=13d57e64352a5d3457d7782bc2f8b576e12b05f3'>13d57e64352a5d3457d7782bc2f8b576e12b05f3 (diff)
regulator: axp20x: Use of_match name as default regulator name
Originally the helper macros used uppercase regulator names, which are primarily used to expand to the regulator ID enum, as the default names. This is aestheticly unpleasent. Since the of_match bits are the same, just lowercase, use that as the default names instead. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'Documentation/kobject.txt')