summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-09 07:11:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:40 -0500
commit7b7619e0ba489329ced5f5159f97ba7da5aa3fa5 (patch)
tree3aa0339df6ff36ee2ab6388c24d8fd1471397861
parent6350e5cb601f64524f1ea9584cb290055ca04147 (diff)
downloadsamba-7b7619e0ba489329ced5f5159f97ba7da5aa3fa5.tar.gz
samba-7b7619e0ba489329ced5f5159f97ba7da5aa3fa5.tar.bz2
samba-7b7619e0ba489329ced5f5159f97ba7da5aa3fa5.zip
r2871: - 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 (This used to be commit b04202eaacc87d264d463f75673ee0e68cd54f94)
-rw-r--r--source4/lib/util_str.c18
-rw-r--r--source4/lib/util_unistr.c12
-rw-r--r--source4/param/loadparm.c6
3 files changed, 12 insertions, 24 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index c4c68a3dcd..89c26e6d22 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -612,19 +612,6 @@ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len)
}
}
-/**
- 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 @@ void rfc1738_unescape(char *buf)
}
}
-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 @@ void base64_decode_inplace(char *s)
**/
char * base64_encode_data_blob(DATA_BLOB data)
{
+ const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int bits = 0;
int char_count = 0;
size_t out_cnt = 0;
diff --git a/source4/lib/util_unistr.c b/source4/lib/util_unistr.c
index 8b7504986f..480fb6c72e 100644
--- a/source4/lib/util_unistr.c
+++ b/source4/lib/util_unistr.c
@@ -32,13 +32,9 @@ load the case handling tables
********************************************************************/
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 @@ static void load_case_tables(void)
/* 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 @@ static void load_case_tables(void)
}
}
- 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");
}
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index bc5ceb00d8..1d53af5c81 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2522,7 +2522,11 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
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: