Changeset 3b32017 for account.c


Ignore:
Timestamp:
2008-08-19T22:21:07Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
88d2208
Parents:
a830512
Message:

Better handling of NULLs passed to set_eval_account(). Still confusing
though, set_reset() is broken for variables that can actually be NULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • account.c

    ra830512 r3b32017  
    7979                return NULL;
    8080       
    81         if( strcmp( set->key, "username" ) == 0 )
     81        if( strcmp( set->key, "server" ) == 0 )
     82        {
     83                g_free( acc->server );
     84                if( value && *value )
     85                {
     86                        acc->server = g_strdup( value );
     87                        return value;
     88                }
     89                else
     90                {
     91                        acc->server = NULL;
     92                        return g_strdup( set->def );
     93                }
     94        }
     95        else if( value == NULL )
     96        {
     97                /* Noop, the other three can't be NULL. */
     98        }
     99        else if( strcmp( set->key, "username" ) == 0 )
    82100        {
    83101                g_free( acc->user );
     
    90108                acc->pass = g_strdup( value );
    91109                return NULL;    /* password shouldn't be visible in plaintext! */
    92         }
    93         else if( strcmp( set->key, "server" ) == 0 )
    94         {
    95                 g_free( acc->server );
    96                 if( *value )
    97                 {
    98                         acc->server = g_strdup( value );
    99                         return value;
    100                 }
    101                 else
    102                 {
    103                         acc->server = NULL;
    104                         return g_strdup( set->def );
    105                 }
    106110        }
    107111        else if( strcmp( set->key, "auto_connect" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.