Author: vlendec Date: 2007-06-30 09:15:33 +0000 (Sat, 30 Jun 2007) New Revision: 23665
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23665 Log: Remove two unneeded global variables Modified: branches/SAMBA_3_0/source/lib/privileges_basic.c branches/SAMBA_3_0/source/rpc_parse/parse_lsa.c branches/SAMBA_3_0_26/source/lib/privileges_basic.c branches/SAMBA_3_0_26/source/rpc_parse/parse_lsa.c Changeset: Modified: branches/SAMBA_3_0/source/lib/privileges_basic.c =================================================================== --- branches/SAMBA_3_0/source/lib/privileges_basic.c 2007-06-30 00:22:59 UTC (rev 23664) +++ branches/SAMBA_3_0/source/lib/privileges_basic.c 2007-06-30 09:15:33 UTC (rev 23665) @@ -364,15 +364,10 @@ int count_all_privileges( void ) { - static int count; - - if ( count ) - return count; - - /* loop over the array and count it */ - for ( count=0; !se_priv_equal(&privs[count].se_priv, &se_priv_end); count++ ) ; - - return count; + /* + * The -1 is due to the weird SE_END record... + */ + return (sizeof(privs) / sizeof(privs[0])) - 1; } @@ -404,9 +399,8 @@ Convert a LUID to a named string ****************************************************************************/ -char* luid_to_privilege_name(const LUID *set) +const char *luid_to_privilege_name(const LUID *set) { - static fstring name; int i; if (set->high != 0) @@ -414,8 +408,7 @@ for ( i=0; !se_priv_equal(&privs[i].se_priv, &se_priv_end); i++ ) { if ( set->low == privs[i].luid.low ) { - fstrcpy( name, privs[i].name ); - return name; + return privs[i].name; } } Modified: branches/SAMBA_3_0/source/rpc_parse/parse_lsa.c =================================================================== --- branches/SAMBA_3_0/source/rpc_parse/parse_lsa.c 2007-06-30 00:22:59 UTC (rev 23664) +++ branches/SAMBA_3_0/source/rpc_parse/parse_lsa.c 2007-06-30 09:15:33 UTC (rev 23665) @@ -3216,7 +3216,7 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges ) { uint32 i; - char *privname; + const char *privname; const char **privname_array = NULL; int num_priv = 0; Modified: branches/SAMBA_3_0_26/source/lib/privileges_basic.c =================================================================== --- branches/SAMBA_3_0_26/source/lib/privileges_basic.c 2007-06-30 00:22:59 UTC (rev 23664) +++ branches/SAMBA_3_0_26/source/lib/privileges_basic.c 2007-06-30 09:15:33 UTC (rev 23665) @@ -364,15 +364,10 @@ int count_all_privileges( void ) { - static int count; - - if ( count ) - return count; - - /* loop over the array and count it */ - for ( count=0; !se_priv_equal(&privs[count].se_priv, &se_priv_end); count++ ) ; - - return count; + /* + * The -1 is due to the weird SE_END record... + */ + return (sizeof(privs) / sizeof(privs[0])) - 1; } @@ -404,9 +399,8 @@ Convert a LUID to a named string ****************************************************************************/ -char* luid_to_privilege_name(const LUID *set) +const char *luid_to_privilege_name(const LUID *set) { - static fstring name; int i; if (set->high != 0) @@ -414,8 +408,7 @@ for ( i=0; !se_priv_equal(&privs[i].se_priv, &se_priv_end); i++ ) { if ( set->low == privs[i].luid.low ) { - fstrcpy( name, privs[i].name ); - return name; + return privs[i].name; } } Modified: branches/SAMBA_3_0_26/source/rpc_parse/parse_lsa.c =================================================================== --- branches/SAMBA_3_0_26/source/rpc_parse/parse_lsa.c 2007-06-30 00:22:59 UTC (rev 23664) +++ branches/SAMBA_3_0_26/source/rpc_parse/parse_lsa.c 2007-06-30 09:15:33 UTC (rev 23665) @@ -3172,7 +3172,7 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges ) { uint32 i; - char *privname; + const char *privname; const char **privname_array = NULL; int num_priv = 0;
