]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix compiler warnings
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 May 2012 09:06:21 +0000 (11:06 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 11 Jun 2012 10:13:21 +0000 (12:13 +0200)
src/modules/rlm_passwd/rlm_passwd.c

index be6f064f4093cda3cd964331851fcc855c1dcf13..cd96eeee980fe3473d8f4305283e79b0e4a95f77 100644 (file)
@@ -155,8 +155,6 @@ static void release_ht(struct hashtable * ht){
 static struct hashtable * build_hash_table (const char * file, int nfields,
        int keyfield, int islist, int tablesize, int ignorenis, char delimiter)
 {
-#define passwd ((struct mypasswd *) ht->buffer)
-       char buffer[1024];
        struct hashtable* ht;
        size_t len;
        unsigned int h;
@@ -164,6 +162,7 @@ static struct hashtable * build_hash_table (const char * file, int nfields,
        char *list;
        char *nextlist=0;
        int i;
+       char buffer[1024];
 
        ht = (struct hashtable *) rad_malloc(sizeof(struct hashtable));
        if(!ht) {
@@ -247,12 +246,14 @@ static struct hashtable * build_hash_table (const char * file, int nfields,
 static struct mypasswd * get_next(char *name, struct hashtable *ht,
                                  struct mypasswd **last_found)
 {
-#define passwd ((struct mypasswd *) ht->buffer)
+       struct mypasswd * passwd;
        struct mypasswd * hashentry;
        char buffer[1024];
        int len;
        char *list, *nextlist;
 
+       passwd = (struct mypasswd *) ht->buffer;
+
        if (ht->tablesize > 0) {
                /* get saved address of next item to check from buffer */
                hashentry = *last_found;
@@ -267,6 +268,9 @@ static struct mypasswd * get_next(char *name, struct hashtable *ht,
        }
        /*      printf("try to find in file\n"); */
        if (!ht->fp) return NULL;
+
+       passwd = (struct mypasswd *) ht->buffer;
+
        while (fgets(buffer, 1024,ht->fp)) {
                if(*buffer && *buffer!='\n' && (len = string_to_entry(buffer, ht->nfields, ht->delimiter, passwd, sizeof(ht->buffer)-1)) &&
                        (!ht->ignorenis || (*buffer !='-' && *buffer != '+') ) ){
@@ -288,7 +292,6 @@ static struct mypasswd * get_next(char *name, struct hashtable *ht,
        fclose(ht->fp);
        ht->fp = NULL;
        return NULL;
-#undef passwd
 }
 
 static struct mypasswd * get_pw_nam(char * name, struct hashtable* ht,