From: David Bremner <david@tethera.net>
To: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
"Tomi Ollila" <tomi.ollila@iki.fi>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH] compat: expose canonicalize_file_name to C++
Date: Fri, 23 Apr 2021 14:31:43 -0300 [thread overview]
Message-ID: <877dks3o1s.fsf@tethera.net> (raw)
In-Reply-To: <YHwMLJ8S5ZK4oA8B@danh.dev>
Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
>
> Yes, inline function are always better than macro.
> I feel embarassed that I couldn't think about that earlier.
>
> Here is a revised patch:
This version still has some issues on a glibc system.
,----
| In file included from notmuch-client.h:31,
| from debugger.c:21:
| ./compat/compat.h: In function ‘notmuch_canonicalize_file_name’:
| ./compat/compat.h:44:9: warning: implicit declaration of function ‘canonicalize_file_name’; did you mean ‘notmuch_canonicalize_file_name’? [-Wimplicit-function-declaration]
| 44 | return canonicalize_file_name (path);
| | ^~~~~~~~~~~~~~~~~~~~~~
| | notmuch_canonicalize_file_name
| ./compat/compat.h:44:9: warning: returning ‘int’ from a function with return type ‘char *’ makes pointer from integer without a cast [-Wint-conversion]
| 44 | return canonicalize_file_name (path);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`----
I guess compat.h needs to define _GNU_SOURCE and include stdlib.h?
,----
| /usr/include/stdlib.h:790:14: error: conflicting types for ‘canonicalize_file_name’
| 790 | extern char *canonicalize_file_name (const char *__name)
| | ^~~~~~~~~~~~~~~~~~~~~~
| In file included from notmuch-client.h:31,
| from debugger.c:21:
| ./compat/compat.h:44:9: note: previous implicit declaration of ‘canonicalize_file_name’ was here
| 44 | return canonicalize_file_name (path);
| | ^~~~~~~~~~~~~~~~~~~~~~
| make: *** [Makefile.local:204: debugger.o] Error 1
`----
I guess that's the same issue?
I was thinking if we are going to have provide
notmuch_canonicalize_file_name, it might make more sense to start e.g.
util/path-util.{c,h}, and put the relevant inline (or not) function
there. I guess either the current approach (with appropriate fixes), or
putting things in util is fine.
d
next prev parent reply other threads:[~2021-04-23 17:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-17 0:18 [PATCH] compat: expose canonicalize_file_name to C++ Đoàn Trần Công Danh
2021-04-17 12:13 ` David Bremner
2021-04-17 12:49 ` Đoàn Trần Công Danh
2021-04-17 14:39 ` David Bremner
2021-04-18 4:13 ` Đoàn Trần Công Danh
2021-04-18 7:08 ` Tomi Ollila
2021-04-18 10:38 ` Đoàn Trần Công Danh
2021-04-23 17:31 ` David Bremner [this message]
2021-04-24 0:29 ` Đoàn Trần Công Danh
2021-04-18 12:48 ` David Bremner
2021-04-18 16:19 ` Tomi Ollila
2021-04-18 16:47 ` Tomi Ollila
2021-04-24 0:57 ` [PATCH v3] compat: rename {,notmuch_}canonicalize_file_name Đoàn Trần Công Danh
2021-04-24 1:01 ` Đoàn Trần Công Danh
2021-04-24 1:05 ` [PATCH v4] " Đoàn Trần Công Danh
2021-04-24 11:43 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dks3o1s.fsf@tethera.net \
--to=david@tethera.net \
--cc=congdanhqx@gmail.com \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).