svn commit: samba r2871 - in branches/SAMBA_4_0/source: lib param
tridge at samba.org
tridge at samba.org
Sat Oct 9 07:11:22 GMT 2004
Author: tridge
Date: 2004-10-09 07:11:21 +0000 (Sat, 09 Oct 2004)
New Revision: 2871
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2871&nolog=1
Log:
- got rid of the last bits of non-threadsafe data in util_str.o
- switch the fallback case tables to use talloc
- moved the used-once octal_string() inline in loadparm.c
Modified:
branches/SAMBA_4_0/source/lib/util_str.c
branches/SAMBA_4_0/source/lib/util_unistr.c
branches/SAMBA_4_0/source/param/loadparm.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util_str.c 2004-10-09 02:05:38 UTC (rev 2870)
+++ branches/SAMBA_4_0/source/lib/util_str.c 2004-10-09 07:11:21 UTC (rev 2871)
@@ -612,20 +612,7 @@
}
}
-/**
- Write an octal as a string.
-**/
-const char *octal_string(int i)
-{
- static char ret[64];
- if (i == -1)
- return "-1";
- slprintf(ret, sizeof(ret)-1, "0%o", i);
- return ret;
-}
-
-
/**
Strchr and strrchr_m are a bit complex on general multi-byte strings.
**/
@@ -954,13 +941,13 @@
}
}
-static const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
/**
* Decode a base64 string into a DATA_BLOB - simple and slow algorithm
**/
DATA_BLOB base64_decode_data_blob(const char *s)
{
+ const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
int bit_offset, byte_offset, idx, i, n;
DATA_BLOB decoded = data_blob(s, strlen(s)+1);
uint8_t *d = decoded.data;
@@ -1010,6 +997,7 @@
**/
char * base64_encode_data_blob(DATA_BLOB data)
{
+ const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int bits = 0;
int char_count = 0;
size_t out_cnt = 0;
Modified: branches/SAMBA_4_0/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util_unistr.c 2004-10-09 02:05:38 UTC (rev 2870)
+++ branches/SAMBA_4_0/source/lib/util_unistr.c 2004-10-09 07:11:21 UTC (rev 2871)
@@ -32,13 +32,9 @@
********************************************************************/
static void load_case_tables(void)
{
- static int initialised;
int i;
TALLOC_CTX *mem_ctx;
- if (initialised) return;
- initialised = 1;
-
mem_ctx = talloc_init("load_case_tables");
if (!mem_ctx) {
smb_panic("No memory for case_tables");
@@ -49,9 +45,9 @@
/* we would like Samba to limp along even if these tables are
not available */
- if (!upcase_table) {
+ if (upcase_table == NULL) {
DEBUG(1,("creating lame upcase table\n"));
- upcase_table = malloc(0x20000);
+ upcase_table = talloc_named_const(NULL, 0x20000, "upcase_table");
if (!upcase_table) {
smb_panic("No memory for upcase tables");
}
@@ -63,9 +59,9 @@
}
}
- if (!lowcase_table) {
+ if (lowcase_table == NULL) {
DEBUG(1,("creating lame lowcase table\n"));
- lowcase_table = malloc(0x20000);
+ lowcase_table = talloc_named_const(NULL, 0x20000, "lowcase_table");
if (!lowcase_table) {
smb_panic("No memory for lowcase tables");
}
Modified: branches/SAMBA_4_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.c 2004-10-09 02:05:38 UTC (rev 2870)
+++ branches/SAMBA_4_0/source/param/loadparm.c 2004-10-09 07:11:21 UTC (rev 2871)
@@ -2522,7 +2522,11 @@
break;
case P_OCTAL:
- fprintf(f, "%s", octal_string(*(int *)ptr));
+ if (*(int *)ptr == -1) {
+ fprintf(f, "-1");
+ } else {
+ fprintf(f, "0%o", *(int *)ptr);
+ }
break;
case P_LIST:
More information about the samba-cvs
mailing list