Skip to content

Commit

Permalink
cgen: do not generate unnecessary memdup() definition
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Oct 7, 2023
1 parent 0a4fa27 commit e957e5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion vlib/builtin/builtin.c.v
Expand Up @@ -605,6 +605,7 @@ pub fn free(ptr voidptr) {
// returns a pointer to the newly allocated space.
[unsafe]
pub fn memdup(src voidptr, sz int) voidptr {
// pub fn memdup(src voidptr, sz isize) voidptr {
$if trace_memdup ? {
C.fprintf(C.stderr, c'memdup size: %10d\n', sz)
}
Expand All @@ -619,6 +620,7 @@ pub fn memdup(src voidptr, sz int) voidptr {

[unsafe]
pub fn memdup_noscan(src voidptr, sz int) voidptr {
// pub fn memdup_noscan(src voidptr, sz isize) voidptr {
$if trace_memdup ? {
C.fprintf(C.stderr, c'memdup_noscan size: %10d\n', sz)
}
Expand All @@ -636,7 +638,7 @@ pub fn memdup_noscan(src voidptr, sz int) voidptr {
// memdup_uncollectable then copies the contents of `src` into the allocated
// space and returns a pointer to the newly allocated space.
[unsafe]
pub fn memdup_uncollectable(src voidptr, sz int) voidptr {
pub fn memdup_uncollectable(src voidptr, sz isize) voidptr {
$if trace_memdup ? {
C.fprintf(C.stderr, c'memdup_uncollectable size: %10d\n', sz)
}
Expand Down
3 changes: 3 additions & 0 deletions vlib/v/gen/c/cgen.v
Expand Up @@ -1004,6 +1004,9 @@ fn (mut g Gen) base_type(_t ast.Type) string {
return 'u64'
}
}
if t == ast.int_type {
//return 'i64'
}
share := t.share()
mut styp := if share == .atomic_t { t.atomic_typename() } else { g.cc_type(t, true) }
if t.has_flag(.shared_f) {
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/gen/c/cheaders.v
Expand Up @@ -523,7 +523,7 @@ void _vcleanup(void);
#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )
void v_free(voidptr ptr);
voidptr memdup(voidptr src, int sz);
//voidptr memdup(voidptr src, isize sz);
#if INTPTR_MAX == INT32_MAX
#define TARGET_IS_32BIT 1
Expand Down

0 comments on commit e957e5c

Please sign in to comment.