Closed ALiwoto closed 3 years ago
You didn't add the header files. Where are they?
Make sure you do git add
before git commit
if you create new files.
Please git add
them and git push
to your branch.
It's your first real PR to this project, and it's a very bad PR.
typedef
is ok, but only the real definition uses underscore at the beginning.src/gwbot/gwbot.c
, and now it's conflicting with my branch and cannot be merged.typedef
typedef
problem above should be clear what to fix (just remove the underscore from aliased type).I need a function to convert JSON string to these C structs.
Function signature:
int tg_event_load(const char *json, tg_event_msg *event);
Usage example:
void fx()
{
int ret;
const char *json = "... json string here ...";
tg_event_msg event; /* uninitalized struct */
ret = tg_event_load(json, &event);
/*
* - returns 0 if success
* - returns negative value of error code if failed
*/
if (ret != 0) {
if (ret == -EINVAL) {
// Error invalid argument
}
if (ret == -ENOMEM) {
// Error no memory
}
// blah, whatever error handling
// See also: https://chromium.googlesource.com/chromiumos/docs/+/master/constants/errnos.md
return;
}
/*
*
* I want to use `event->blabla` here!
*
*/
}
gwbot.c
with its original contentTake a deep breath and relax your body.
git status
Make sure you see: nothing to commit, working tree clean
.
If there is uncommited thing, clean it up first.
Checkout to my branch
git checkout ammarfaizi2-dev
Create a copy of my original gwbot.c
cp src/gwbot/gwbot.c gwbot.c.bak
Checkout back to your branch
git checkout aliwoto-dev
Delete changed gwbot.c
rm -v src/gwbot/gwbot.c
Restore gwbot.c
cp -v gwbot.c.bak src/gwbot/gwbot.c
Hey! About your commit message, it's incredibly stupid. You're not clean, and I ask you to clean yourself up! They are totally unreadable descriptions. You should try to compare the quality of your commit message with the Linux kernel git logs or some other projects, and cry yourself to sleep.
You might think, "why would I need to take time to think a good commit message? it's wasting my time"
.
Writing good commit message is a good discipline. At first, any discipline feels slower. Because when you are exercising a discipline, you are stepping through the discipline one step at a time. But it speeds you (or team) up at the end. If you're not clean, you will get slowed down at some point because you and other contributors will be dealing with your dirtiness. Good project can be timeless, don't be in hurry in doing things.
For example, short commit should be at least like this: https://github.com/torvalds/linux/commit/64395d950bc476106b39341e42ebfd4d2eb71d2c
Long commit message can be like this: https://github.com/torvalds/linux/commit/5be28c8f85ce99ed2d329d2ad8bdd18ea19473a5
You need to use git rebase
, so let's implement git rebase
in real world application, I know you never used git rebase
in your life, so try it. I can tolerate other commits message at the moment, but no with those last 2 commits which contains only dots.
git log
(see the commit messages, and take one below commit before your dirty commit). So you can take start point at 6fc2bec54d7441a112abd44daf312211933c5c1a
, it's called commit hash (copy it, but copy it from your git log, so you can learn how to do it, don't copy the hash from this comment).git rebase -i <your-commit-hash>
(start rebasing, it will open a text editor)
pick 20522fd ...
pick 76e35ae ...
4. Change the `pick` to `reword` (you can also use `r`, it's the same as `reword`), should look like this:
r 20522fd ... r 76e35ae ...
5. Save the change and close your text editor.
6. It will open another text editor once you close it.
7. Edit your commit message, give it descriptive name, save it, and close your text editor.
8. `git push -vf` (-vf means verbose and force, you need to force because it changes the old history commit).
Ok, STOP, STOP, STOP!
You don't understand what problem you are having right now. I don't want you to continue this sh*t! You didn't fully address my important comments at all.
Please wait for it, I will make unit test for you.
Really, please wait for me to make unit test for you, it's very cool and clean (just follow me, ok?).
So, what can you do while I am writing unit test for you? You can do anything you want (not must related to this project), so you take a break until the unit test is finished.
I will finish it tomorrow (if I get the time), stay tuned.
Fortunately, I asked to you to push earlier, if not, how far would you go? That would be too far.
structures for receiving events!