Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2019-11-01 03:17:35 +0300
committerHieu Hoang <hieuhoang@gmail.com>2019-11-01 03:17:35 +0300
commit3dce8f6709fa207665667c7d0aaa49d44e6f2bf6 (patch)
treeedd31e11253cf832cacee2e38e0df18b960727cf
parent187a75cb5596c8e4362c66c62de395e2b7d3a64a (diff)
convert .c to .cpp. Clang insists on using clang++ for some reasonclang-error
-rw-r--r--symal/Jamfile2
-rw-r--r--symal/cmd.cpp (renamed from symal/cmd.c)12
-rw-r--r--symal/cmd.h7
3 files changed, 7 insertions, 14 deletions
diff --git a/symal/Jamfile b/symal/Jamfile
index 3ab564790..3163d1e53 100644
--- a/symal/Jamfile
+++ b/symal/Jamfile
@@ -1,2 +1,2 @@
-exe symal : symal.cpp cmd.c ;
+exe symal : symal.cpp cmd.cpp ;
diff --git a/symal/cmd.c b/symal/cmd.cpp
index e1a667eb9..8c12c4f57 100644
--- a/symal/cmd.c
+++ b/symal/cmd.cpp
@@ -144,7 +144,7 @@ int DeclareParams(const char *ParName, ...)
cmds[j].p = va_arg(args, void *);
break;
case CMDSUBRANGETYPE: { /* get the two extremes */
- int *subrange = calloc(2, sizeof(int));
+ int *subrange = (int*) calloc(2, sizeof(int));
cmds[j].p = subrange;
subrange[0] = va_arg(args, int);
subrange[1] = va_arg(args, int);
@@ -152,7 +152,7 @@ int DeclareParams(const char *ParName, ...)
break;
case CMDGTETYPE: /* get lower or upper bound */
case CMDLTETYPE: {
- int *value = calloc(1, sizeof(int));
+ int *value = (int*) calloc(1, sizeof(int));
cmds[j].p = value;
value[0] = va_arg(args, int);
}
@@ -320,12 +320,12 @@ static char **str2array(const char *s, const char *sep)
p += strspn(p, sep);
++n;
}
- a = calloc(n+1, sizeof(char *));
+ a = (char**) calloc(n+1, sizeof(char *));
p = s;
n = 0;
while(*p) {
l = strcspn(p, sep);
- a[n] = malloc(l+1);
+ a[n] = (char*) malloc(l+1);
memcpy(a[n], p, l);
a[n][l] = 0;
++n;
@@ -479,7 +479,7 @@ static void PrintStrArray(const Cmd_T *cmd, int ValFlag, FILE *fp)
int l = 4+strlen(cmd->Name);
fprintf(fp, "%s", cmd->Name);
- indent = malloc(l+2);
+ indent = (char*) malloc(l+2);
memset(indent, ' ', l+1);
indent[l+1] = 0;
if(ValFlag) {
@@ -578,7 +578,7 @@ int GetParams(int *n, char ***a, const char *CmdFileName)
#define PATHSEP '/'
#endif
- if(!(Line=malloc(LINSIZ))) {
+ if(!(Line= (char*) malloc(LINSIZ))) {
fprintf(stderr, "GetParams(): Unable to alloc %d bytes\n",
LINSIZ);
exit(1);
diff --git a/symal/cmd.h b/symal/cmd.h
index 71b2cd94a..9c4e0e18d 100644
--- a/symal/cmd.h
+++ b/symal/cmd.h
@@ -22,14 +22,7 @@ typedef struct {
int Idx;
} Enum_T;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int DeclareParams(const char *, ...);
int GetParams(int *n, char ***a, const char *CmdFileName);
-#ifdef __cplusplus
-}
-#endif
#endif