Snap for 8261343 from b31c7fdb2703a87dba0c72809e58720aa5dbe7b0 to tm-release

Change-Id: I7a46ada817ba8bffa4ee008759cdf95c7ab1dbea
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 5809fb6..227e97d 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
 {
   "git": {
-    "sha1": "d0e0ab4cb4e060c37bfcbb0c2eebe1325186cad6"
-  }
-}
+    "sha1": "d6b00e821e9148bada1aa4eccc29a5948dc4ab23"
+  },
+  "path_in_vcs": ""
+}
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 02cb373..412407c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,7 +44,7 @@
     host_supported: true,
     crate_name: "rusticata_macros",
     cargo_env_compat: true,
-    cargo_pkg_version: "4.0.0",
+    cargo_pkg_version: "4.1.0",
     srcs: ["src/lib.rs"],
     edition: "2018",
     rustlibs: [
@@ -57,7 +57,7 @@
     host_supported: true,
     crate_name: "rusticata_macros",
     cargo_env_compat: true,
-    cargo_pkg_version: "4.0.0",
+    cargo_pkg_version: "4.1.0",
     srcs: ["src/lib.rs"],
     test_suites: ["general-tests"],
     auto_gen_config: true,
diff --git a/Cargo.toml b/Cargo.toml
index def8c45..6c9bccf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,17 +3,16 @@
 # When uploading crates to the registry Cargo will automatically
 # "normalize" Cargo.toml files for maximal compatibility
 # with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
 #
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
 
 [package]
 edition = "2018"
 name = "rusticata-macros"
-version = "4.0.0"
+version = "4.1.0"
 authors = ["Pierre Chifflier <chifflier@wzdftpd.net>"]
 description = "Helper macros for Rusticata"
 homepage = "https://github.com/rusticata/rusticata-macros"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 983518e..cb377fc 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "rusticata-macros"
-version = "4.0.0"
+version = "4.1.0"
 description = "Helper macros for Rusticata"
 license = "MIT/Apache-2.0"
 keywords = ["parser","nom","serialize"]
diff --git a/METADATA b/METADATA
index 7793cf9..d87a4ea 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/rusticata-macros/rusticata-macros-4.0.0.crate"
+    value: "https://static.crates.io/crates/rusticata-macros/rusticata-macros-4.1.0.crate"
   }
-  version: "4.0.0"
+  version: "4.1.0"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2021
-    month: 9
-    day: 22
+    year: 2022
+    month: 3
+    day: 1
   }
 }
diff --git a/README.md b/README.md
index 42cd1fd..0232006 100644
--- a/README.md
+++ b/README.md
@@ -14,18 +14,16 @@
 
 This crate contains some additions to [nom](https://github.com/Geal/nom).
 
-For example, the `error_if!` macro allows to test a condition and return an error from the parser if the condition
-fails:
+For example, the [`combinator::cond_else`] function allows to apply the first parser if the
+condition is true, and the second if the condition is false:
 
 ```rust
-use rusticata_macros::error_if;
-let r : IResult<&[u8],()> = do_parse!(
-    s,
-    l: be_u8 >>
-    error_if!(l < 4, ErrorKind::Verify) >>
-    data: take!(l - 4) >>
-    (())
-    );
+use rusticata_macros::combinator::cond_else;
+let r: IResult<_, _, ()> = cond_else(
+        || s.len() > 1,
+        be_u16,
+        map(be_u8, u16::from)
+    )(s);
 ```
 
 See the documentation for more details and examples.
@@ -48,6 +46,10 @@
 
 ## Changes
 
+### 4.1.0
+
+- Remove macro `slice_fixed`
+
 ### 4.0.0
 
 - Upgrade to nom 7
diff --git a/src/combinator.rs b/src/combinator.rs
index d542557..6b6a8b3 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2,8 +2,8 @@
 
 use nom::bytes::streaming::take;
 use nom::combinator::map_parser;
-pub use nom::error::{make_error, ErrorKind, ParseError};
-pub use nom::{IResult, Needed, Parser};
+use nom::error::{make_error, ErrorKind, ParseError};
+use nom::{IResult, Needed, Parser};
 use nom::{InputIter, InputTake};
 use nom::{InputLength, ToUsize};
 
diff --git a/src/lib.rs b/src/lib.rs
index 119ea48..8d23249 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,7 +4,7 @@
 //!
 //! This crate contains some additions to [nom](https://github.com/Geal/nom).
 //!
-//! For example, the [`cond_else`] function allows to apply the first parser if the
+//! For example, the [`combinator::cond_else`] function allows to apply the first parser if the
 //! condition is true, and the second if the condition is false:
 //!
 //! ```rust
@@ -31,16 +31,14 @@
     unused_qualifications
 )]
 
-extern crate nom;
-
-extern crate core;
-
 pub mod combinator;
-
+pub mod debug;
 pub use macros::*;
 #[macro_use]
 pub mod macros;
 
-pub mod debug;
 mod traits;
 pub use traits::*;
+
+// re-exports
+pub use nom;
diff --git a/src/macros.rs b/src/macros.rs
index 6109162..9ff2f69 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -2,8 +2,7 @@
 
 use nom::bytes::complete::take;
 use nom::combinator::map_res;
-pub use nom::error::{make_error, ErrorKind, ParseError};
-pub use nom::{IResult, Needed};
+use nom::IResult;
 
 #[doc(hidden)]
 pub mod export {
@@ -142,29 +141,6 @@
 
 //named!(parse_hex4<&[u8], u64>, parse_hex_to_u64!(4));
 
-/// Parse a slice and return a fixed-sized array of bytes
-///
-/// This creates a copy of input data
-/// Uses unsafe code
-#[macro_export]
-macro_rules! slice_fixed(
-    ( $i:expr, $count:expr ) => (
-        {
-            let cnt = $count;
-            let ires: IResult<_,_> = if $i.len() < cnt {
-                Err(::nom::Err::Incomplete(Needed::new(cnt)))
-            } else {
-                let mut res: [u8; $count] = unsafe {
-                    $crate::export::mem::MaybeUninit::uninit().assume_init()
-                };
-                unsafe{$crate::export::ptr::copy($i.as_ptr(), res.as_mut_ptr(), cnt)};
-                Ok((&$i[cnt..],res))
-            };
-            ires
-        }
-    );
-);
-
 /// Combination and flat_map! and take! as first combinator
 #[macro_export]
 macro_rules! flat_take (
@@ -260,37 +236,10 @@
 #[cfg(test)]
 mod tests {
     use nom::error::ErrorKind;
-    use nom::number::streaming::{be_u16, be_u32, be_u8};
+    use nom::number::streaming::{be_u16, be_u32};
     use nom::{error_position, Err, IResult, Needed};
 
     #[test]
-    #[allow(unsafe_code)]
-    fn test_slice_fixed() {
-        let empty = &b""[..];
-        let b = &[0x01, 0x02, 0x03, 0x04, 0x05];
-
-        let res = slice_fixed!(b, 4);
-        assert_eq!(res, Ok((&b[4..], [1, 2, 3, 4])));
-
-        // can we still use the result ?
-        match res {
-            Ok((rem, _)) => {
-                let res2: IResult<&[u8], u8> = be_u8(rem);
-                assert_eq!(res2, Ok((empty, 5)));
-            }
-            _ => (),
-        }
-    }
-
-    #[test]
-    #[allow(unsafe_code)]
-    fn test_slice_fixed_incomplete() {
-        let b = &[0x01, 0x02, 0x03, 0x04, 0x05];
-        let res = slice_fixed!(b, 8);
-        assert_eq!(res, Err(Err::Incomplete(Needed::new(8))));
-    }
-
-    #[test]
     fn test_error_if() {
         let empty = &b""[..];
         let res: IResult<&[u8], ()> = error_if!(empty, true, ErrorKind::Tag);