lib: Move ucs2_align() to 'charset' subsystem
authorVolker Lendecke <vl@samba.org>
Mon, 4 Jan 2021 10:14:56 +0000 (11:14 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 12 Jan 2021 00:10:30 +0000 (00:10 +0000)
Fix a circular dependency: util_str_common.c depends on 'charset',
which depends on util_str_common.c. Fix that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/charset/charset.h
lib/util/charset/util_unistr.c
lib/util/samba_util.h
lib/util/util_str_common.c
source3/include/proto.h

index ef7911a62546d9e72810cb4c4be56b9ecf4731b8..3aa8a812cccb276ff0bcec63258bfdd346175653 100644 (file)
@@ -93,6 +93,8 @@ typedef struct smb_iconv_s {
 struct loadparm_context;
 struct smb_iconv_handle;
 
+size_t ucs2_align(const void *base_ptr, const void *p, int flags);
+
 char *strchr_m(const char *s, char c);
 /**
  * Calculate the number of units (8 or 16-bit, depending on the
index 2cc87186daecbb3c421f1cef37b43d2a66e41cca..ed394f58aef82dcee3d5b8cfeda0fff5b8c8ddf1 100644 (file)
@@ -180,6 +180,14 @@ _PUBLIC_ size_t count_chars_m(const char *s, char c)
        return count;
 }
 
+size_t ucs2_align(const void *base_ptr, const void *p, int flags)
+{
+       if (flags & (STR_NOALIGN|STR_ASCII)) {
+               return 0;
+       }
+       return PTR_DIFF(p, base_ptr) & 1;
+}
+
 
 /**
  * Copy a string from a char* unix src to a dos codepage string destination.
index 4ff3f7ff35c52f0429fadc6b159996d351e1440b..a8be028e5638cccceadca67d663726ae2db3954e 100644 (file)
@@ -324,7 +324,6 @@ the result includes the null termination
 limited by 'n' bytes
 **/
 _PUBLIC_ size_t utf16_len_n(const void *src, size_t n);
-_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags);
 
 /**
  * @brief Constant time compare to memory regions.
index 7bdba9a7a8ce27f5d38e12a31712abf713583867..bf0fec8eca487e0ec633f813b8aba97afb93c487 100644 (file)
@@ -59,13 +59,6 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2)
        return (*psz1 - *psz2);
 }
 
-_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags)
-{
-       if (flags & (STR_NOALIGN|STR_ASCII))
-               return 0;
-       return PTR_DIFF(p, base_ptr) & 1;
-}
-
 /**
  String replace.
  NOTE: oldc and newc must be 7 bit characters
index 2f25778ab9f6ebde165fbbf8503d2c0f82beb775..6c9cf130d043a29d2a33e429a065f88f65793d3b 100644 (file)
@@ -41,7 +41,6 @@ const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32_t policy);
 /* The following definitions come from lib/charcnv.c  */
 
 void gfree_charcnv(void);
-size_t ucs2_align(const void *base_ptr, const void *p, int flags);
 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
 size_t push_ascii_fstring(void *dest, const char *src);
 size_t push_ascii_nstring(void *dest, const char *src);