Changeset: 37aba6a68a3a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=37aba6a68a3a
Modified Files:
tools/merovingian/utils/utils.c
tools/merovingian/utils/utils.h
Branch: Jun2016
Log Message:
Add some const keywords.
diffs (102 lines):
diff --git a/tools/merovingian/utils/utils.c b/tools/merovingian/utils/utils.c
--- a/tools/merovingian/utils/utils.c
+++ b/tools/merovingian/utils/utils.c
@@ -117,7 +117,7 @@ freeConfFile(confkeyval *list) {
* Returns true if the key is a default property.
*/
int
-defaultProperty(char *property) {
+defaultProperty(const char *property) {
// TODO: find a better way to do this
if (property != NULL && strcmp(property, "type") == 0) {
return 1;
@@ -142,7 +142,7 @@ defaultProperty(char *property) {
* given key, or NULL if no key was found.
*/
inline confkeyval *
-findConfKey(confkeyval *list, char *key) {
+findConfKey(confkeyval *list, const char *key) {
while (list->key != NULL) {
if (strcmp(list->key, key) == 0)
return(list);
@@ -156,7 +156,7 @@ findConfKey(confkeyval *list, char *key)
* found (or set to NULL)
*/
inline char *
-getConfVal(confkeyval *list, char *key) {
+getConfVal(confkeyval *list, const char *key) {
while (list->key != NULL) {
if (strcmp(list->key, key) == 0)
return(list->val);
@@ -170,7 +170,7 @@ getConfVal(confkeyval *list, char *key)
* 0 if not found.
*/
inline int
-getConfNum(confkeyval *list, char *key) {
+getConfNum(confkeyval *list, const char *key) {
while (list->key != NULL) {
if (strcmp(list->key, key) == 0)
return(list->ival);
@@ -189,7 +189,7 @@ getConfNum(confkeyval *list, char *key)
* the original value for the key is left untouched.
*/
char *
-setConfVal(confkeyval *ckv, char *val) {
+setConfVal(confkeyval *ckv, const char *val) {
int ival = 0;
/* handle the unset directly */
@@ -212,7 +212,7 @@ setConfVal(confkeyval *ckv, char *val) {
return(strdup(buf));
}
case INT: {
- char *p = val;
+ const char *p = val;
while (*p >= '0' && *p <= '9')
p++;
if (*p != '\0') {
@@ -271,7 +271,7 @@ setConfVal(confkeyval *ckv, char *val) {
}
char *
-setConfValForKey(confkeyval *list, char *key, char *val) {
+setConfValForKey(confkeyval *list, const char *key, const char *val) {
char buf[256];
while (list->key != NULL) {
@@ -416,7 +416,7 @@ generateSalt(char *buf, unsigned int len
* random passphrase.
*/
char *
-generatePassphraseFile(char *path)
+generatePassphraseFile(const char *path)
{
int fd;
FILE *f;
diff --git a/tools/merovingian/utils/utils.h b/tools/merovingian/utils/utils.h
--- a/tools/merovingian/utils/utils.h
+++ b/tools/merovingian/utils/utils.h
@@ -31,16 +31,16 @@ typedef struct _confkeyval {
void readConfFile(confkeyval *list, FILE *cnf);
void readConfFileFull(confkeyval *list, FILE *cnf);
void freeConfFile(confkeyval *list);
-int defaultProperty(char *key);
-confkeyval *findConfKey(confkeyval *list, char *key);
-char *getConfVal(confkeyval *list, char *key);
-int getConfNum(confkeyval *list, char *key);
-char *setConfVal(confkeyval *ckv, char *val);
-char *setConfValForKey(confkeyval *list, char *key, char *val);
+int defaultProperty(const char *key);
+confkeyval *findConfKey(confkeyval *list, const char *key);
+char *getConfVal(confkeyval *list, const char *key);
+int getConfNum(confkeyval *list, const char *key);
+char *setConfVal(confkeyval *ckv, const char *val);
+char *setConfValForKey(confkeyval *list, const char *key, const char *val);
void secondsToString(char *buf, time_t t, int longness);
void abbreviateString(char *ret, const char *in, size_t width);
void generateSalt(char *buf, unsigned int len);
-char *generatePassphraseFile(char *path);
+char *generatePassphraseFile(const char *path);
void sleep_ms(size_t ms);
#endif
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list