search for: cstring

Displaying 20 results from an estimated 120 matches for "cstring".

Did you mean: string
2009 Dec 05
4
paste adjacent elements matching string
Hi all, I would like to combine elements of a vector: vec <- c("astring", "b", "cstring", "d", "e") > vec [1] "astring" "b" "cstring" "d" "e" such that for every element that contains "string" at the end, it is combined with the next element, so that I get this: > res [1] &qu...
2013 Mar 21
2
[LLVMdev] (Not) instrumenting global string literals that end up in .cstrings on Mac
(forgot to CC llvmdev) On Thu, Mar 21, 2013 at 5:54 PM, Alexander Potapenko <glider at google.com> wrote: > Hey Anna, Nick, Ted, > > We've the following problem with string literals under ASan on Mac. > Some global string constants end up being put into the .cstring > section, for which the following rules apply: > - the strings can't contain zeroes in their bodies > - the link editor places only one copy of each literal into the > output file's section > > ASan usually instruments the globals by adding redzones to the end of > t...
2013 Mar 21
0
[LLVMdev] (Not) instrumenting global string literals that end up in .cstrings on Mac
Alexander, On Darwin the "__cstring" section (really section with type S_CSTRING_LITERAL) is defined to contain zero terminate strings of bytes that the linker can merge and re-order. If you want pad bytes before and after the string, you need to put the strings in a different section (e.g. __TEXT, __const). But, CF/NSString l...
2004 Jul 03
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
...for windows. Have you tried compiling under >cygwin? No, not yet. >If you grab the latest CVS sources, they should work fine with >cygwin, and will probably work better with windows in general than LLVM >1.2. >Again, I'm sorry that I don't know more about this and why <cstring> >apparently doesn't have strdup, it seems really odd. If <cstring> doesn't >work, you could try <string.h> explicitly, but it would be much better to >use cygwin if you can. As far as I've investigated, it seems more clear to me, that it is the SDK of Interix...
2019 Jun 27
0
[PATCH 6/9] Rust bindings: Add generator of function signatures
...::ptr; use std::os::raw::c_char; @@ -130,6 +132,18 @@ impl CreateFlags { } } +fn arg_string_list (v: &Vec<String>) -> Vec<*const i8> { + let length = v.len(); + let mut w = Vec::new(); + for x in v.iter() { + let y: &str = x; + let s = ffi::CString::new(y).unwrap(); + w.push(s.as_ptr()); + } + w.push(ptr::null()); + w +} + impl Handle { pub fn create() -> Result<Handle, &'static str> { let g = unsafe { guestfs_create() }; @@ -151,6 +165,10 @@ impl Handle { } }\ +pub struct Error { + /...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...self.current >= self.list.size { + None + } else { + let elem = unsafe { self.list.ptr.offset(self.current as isize) }; + self.current += 1; + Some(elem) + } + } +} + +fn arg_string_list(v: &[&str]) -> Result<Vec<ffi::CString>, Error> { let mut w = Vec::new(); for x in v.iter() { let y: &str = x; - let s = ffi::CString::new(y).unwrap(); - w.push(s.as_ptr()); + w.push(ffi::CString::new(y)?); + } + Ok(w) +} + +fn free_string_list(l: *const *const c_char) { + for b...
2004 Jul 03
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
...ram executes: Before the patch: gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support' gmake[1]: Leaving directory `/usr/local/src/llvm/lib/Support' gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support' Compiling CommandLine.cpp CommandLine.cpp: In function `void ParseCStringVector(std::vector<char*, std::allocator<char*> >&, const char*)': CommandLine.cpp:189: error: `strdup' undeclared (first use this function) CommandLine.cpp:189: error: (Each undeclared identifier is reported only once for each function it appears in.) CommandLine.cpp:...
2008 Aug 21
3
[LLVMdev] Fix build on GCC 4.3
...x: include/llvm/ADT/APInt.h =================================================================== --- include/llvm/ADT/APInt.h (revision 55101) +++ include/llvm/ADT/APInt.h (working copy) @@ -20,6 +20,7 @@ #include <cassert> #include <iosfwd> #include <string> +#include <cstring> namespace llvm { class Serializer; -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080821/c0d19448/attachment.html>
2004 Jul 04
0
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
>From: Misha Brukman <brukman at uiuc.edu> >Date: Sat, 3 Jul 2004 19:33:12 -0500 >Well, the patch adds #include <cstring> to CommandLine.cpp, so you >should try the patch first. If it does not work, then the Interix SDK ><cstring> is not a fully complete substitue for <string.h>, which it >should be, then you may have to manually try changing the <cstring> to ><string.h> and go...
2008 Jun 03
2
[LLVMdev] #include problem
Hi, On Fedora 9 GCC 4.3, LLVMCConfigurationEmitter.cpp needs #include <typeinfo>. ValueTracking.cpp needs #include <cstring>. Thanks. --Zhongxing Xu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080603/38f917f4/attachment.html>
2009 Jan 21
2
[LLVMdev] RFA: Constant String c"\000"
...for (unsigned i = 1, e = V.size(); i != e; ++i) if (V[i] != C) return ArrayConstants->getOrCreate(Ty, V); } return ConstantAggregateZero::get(Ty); } This seems wrong to me, and it's causing a problem in Objective-C, which requires that an empty string be placed in the .cstring section. Would it break everything or hurt performance to have a check in here that if this is a [1 x i8] array where C->isNullValue(), we should allow it to stay instead of creating the CAZ, which is translated into a "zeroinitialier"? -bw
2009 Jan 27
4
[LLVMdev] RFC: -fwritable-strings Change
...ull string is placed in the wrong section. If we have this code: #include <Foundation/Foundation.h> void foo() { NSLog(@""); } The null string is defined like this: .const .lcomm LC,1,0 ## LC Causing our linker to go nuts, because it expects anonymous strings to be in the __cstring section. I came up with the attached patch, which places the string in the .cstring section. My GCC-fu isn't great. Could someone review this to see if I broke anything? Thanks! -bw -------------- next part -------------- A non-text attachment was scrubbed... Name: cfstring.diff Type: applica...
2009 Jan 10
2
[LLVMdev] How to represent zero-sized string?
Hi all, int main() { t(""); return 0; } On Mac OS X, llvm-gcc compiles the zero-sized string to: .lcomm LC,1,0 gcc: .cstring LC0: .ascii "\0" The difference seems innocent enough. However, in objc if the zero- sized string is part of a cfstring, it causes a problem. The linker expects it in the readonly __cstring section, but llvm puts it in the read / write bss section. The problem is llvm repr...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be better to spend some time with git rebase -i trying to work this into more coherent patches. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live
2009 Jan 27
0
[LLVMdev] RFC: -fwritable-strings Change
...ode: > > #include <Foundation/Foundation.h> > void foo() { > NSLog(@""); > } > > The null string is defined like this: > > .const > .lcomm LC,1,0 ## LC > > Causing our linker to go nuts, because it expects anonymous strings to > be in the __cstring section. I came up with the attached patch, which > places the string in the .cstring section. > > My GCC-fu isn't great. Could someone review this to see if I broke > anything? I don't see anything obvious wrong, but this is an easy area to break. I'd recommend running t...
2012 Jan 03
2
[LLVMdev] 'Reference Out Of Range' error building llvm/clang with -O4
This is compiling the Trunk revision from last Friday: reference out of range from _llvm_regerror (1000437F0) in ../../lib/libLLVMSupport.a(regerror.c.o) to cstring=0 (0) in ../../lib/libLLVMSupport.a(regerror.c.o) ld: rel32 out of range in _llvm_regerror from ../../lib/libLLVMSupport.a(regerror.c.o) clang-3: error: linker command failed with exit code 1 (use -v to see invocation) OS X 10.6, compling LLVM with LLVM using -O4
2008 Jun 04
0
[LLVMdev] #include problem
On Jun 3, 2008, at 6:48 AM, Zhongxing Xu wrote: > Hi, > > On Fedora 9 GCC 4.3, > > LLVMCConfigurationEmitter.cpp needs #include <typeinfo>. > ValueTracking.cpp needs #include <cstring>. Fixed, thanks: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080602/063303.html -Chris
2016 Nov 25
5
RFC: Constructing StringRefs at compile time
...GCC and Clang treat __builtin_strlen as constexpr. MSVC 2015 doesn't support C++14 extended constexpr. I don't know how well it optimises a recursive strlen. This works as an optimisation for GCC and Clang, and doesn't make things worse for MSVC: /// Construct a string ref from a cstring. LLVM_ATTRIBUTE_ALWAYS_INLINE +#if __has_builtin(__builtin_strlen) + /*implicit*/ constexpr StringRef(const char *Str) + : Data(Str), Length(Str ? __builtin_strlen(Str) : 0) {} +#else /*implicit*/ StringRef(const char *Str) : Data(Str), Length(Str ? ::strlen(Str) : 0) {...
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...+ } } } @@ -193,60 +198,81 @@ impl<'a, T> Iterator for RawListIter<'a, T> { } } - -fn arg_string_list (v: &Vec<&str>) -> Vec<*const i8> { - let length = v.len(); +fn arg_string_list(v: &[&str]) -> Result<Vec<ffi::CString>, Error> { let mut w = Vec::new(); for x in v.iter() { let y: &str = x; - let s = ffi::CString::new(y).unwrap(); - w.push(s.as_ptr()); + w.push(ffi::CString::new(y)?); + } + Ok(w) +} + +fn free_string_list(l: *const *const c_char) { + for b...
2017 Mar 08
3
Use of the C++ standard library in XRay compiler-rt
...atomic> > 1 #include <bitset> > 6 #include <cassert> > 1 #include <cerrno> > 1 #include <cstddef> > 7 #include <cstdint> > 2 #include <cstdio> > 1 #include <cstdlib> > 2 #include <cstring> > 1 #include <deque> > 2 #include <iterator> > 2 #include <limits> > 2 #include <memory> > 4 #include <mutex> > 1 #include <system_error> > 1 #include <thread> > 2 #include <tupl...