Skip to content

Commit 7bd8234

Browse files
cryptomilkvlendec
authored andcommitted
README: Add languages to code blocks for highlighting
Signed-off-by: Andreas Schneider <[email protected]> Reviewed-by: Ralph Boehme <[email protected]> Autobuild-User(master): Volker Lendecke <[email protected]> Autobuild-Date(master): Thu Sep 5 14:27:30 UTC 2024 on atb-devel-224
1 parent 22edd69 commit 7bd8234

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.Coding.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ are the highlights.
4848

4949
Add the follow to your $HOME/.emacs file:
5050

51-
```
51+
```lisp
5252
(add-hook 'c-mode-hook
5353
(lambda ()
5454
(c-set-style "linux")
@@ -63,15 +63,15 @@ Add the follow to your $HOME/.emacs file:
6363
For the basic vi editor included with all variants of \*nix, add the
6464
following to $HOME/.exrc:
6565

66-
```
66+
```vim
6767
set tabstop=8
6868
set shiftwidth=8
6969
```
7070

7171
For Vim, the following settings in $HOME/.vimrc will also deal with
7272
displaying trailing whitespace:
7373

74-
```
74+
```vim
7575
if has("syntax") && (&t_Co > 2 || has("gui_running"))
7676
syntax on
7777
function! ActivateInvisibleCharIndicator()
@@ -113,7 +113,7 @@ of multiple following code blocks.
113113

114114
This is good:
115115

116-
```
116+
```c
117117
...
118118
int i;
119119

@@ -153,7 +153,7 @@ This is good:
153153
154154
This is bad:
155155
156-
```
156+
```c
157157
...
158158
int i;
159159
/*
@@ -191,7 +191,7 @@ align the parameter list with the first parameter on the previous line.
191191
Use tabs to get as close as possible and then fill in the final 7
192192
characters or less with whitespace. For example,
193193

194-
```
194+
```c
195195
var1 = foo(arg1, arg2,
196196
arg3);
197197
```
@@ -214,13 +214,13 @@ Always follow an `if` keyword with a space but don't include additional
214214
spaces following or preceding the parentheses in the conditional.
215215
This is good:
216216

217-
```
217+
```c
218218
if (x == 1)
219219
```
220220

221221
This is bad:
222222

223-
```
223+
```c
224224
if ( x == 1 )
225225
```
226226

@@ -246,7 +246,7 @@ loop.
246246

247247
Good examples:
248248

249-
```
249+
```c
250250
if (x == 1) {
251251
printf("good\n");
252252
}
@@ -269,7 +269,7 @@ Good examples:
269269
270270
Bad examples:
271271
272-
```
272+
```c
273273
while (1)
274274
{
275275
print("I'm in a loop!\n"); }
@@ -296,7 +296,7 @@ idea.
296296

297297
Good Examples:
298298

299-
```
299+
```c
300300
int function foo(int y)
301301
{
302302
int *z = NULL;
@@ -338,7 +338,7 @@ lib/replace/, new code should adhere to the following conventions:
338338
Most of the time a good name for a boolean variable is 'ok'. Here is an
339339
example we often use:
340340
341-
```
341+
```c
342342
bool ok;
343343
344344
ok = foo();
@@ -367,7 +367,7 @@ instructions sequence may change over time.
367367

368368
Good Example:
369369

370-
```
370+
```c
371371
char *pointer1 = NULL;
372372
char *pointer2 = NULL;
373373

@@ -380,7 +380,7 @@ Good Example:
380380

381381
Bad Example:
382382

383-
```
383+
```c
384384
char *pointer1;
385385
char *pointer2;
386386

@@ -441,7 +441,7 @@ it's also easier to use the "step" command within gdb.
441441
442442
Good Example:
443443
444-
```
444+
```c
445445
char *name = NULL;
446446
int ret;
447447
@@ -457,7 +457,7 @@ Good Example:
457457

458458
Bad Example:
459459

460-
```
460+
```c
461461
ret = some_function_my_name(get_some_name());
462462
...
463463
```
@@ -468,7 +468,7 @@ debugger.
468468

469469
Good example:
470470

471-
```
471+
```c
472472
x = malloc(sizeof(short)*10);
473473
if (x == NULL) {
474474
fprintf(stderr, "Unable to alloc memory!\n");
@@ -477,7 +477,7 @@ Good example:
477477
478478
Bad example:
479479
480-
```
480+
```c
481481
if ((x = malloc(sizeof(short)*10)) == NULL ) {
482482
fprintf(stderr, "Unable to alloc memory!\n");
483483
}
@@ -486,7 +486,7 @@ Bad example:
486486
There are exceptions to this rule. One example is walking a data structure in
487487
an iterator style:
488488

489-
```
489+
```c
490490
while ((opt = poptGetNextOpt(pc)) != -1) {
491491
... do something with opt ...
492492
}
@@ -499,7 +499,7 @@ rarely exists for this particular use case, and we gain some
499499
efficiency because the DBG_ macros don't evaluate their arguments if
500500
the debuglevel is not high enough.
501501
502-
```
502+
```c
503503
if (!NT_STATUS_IS_OK(status)) {
504504
struct dom_sid_buf sid_buf;
505505
struct GUID_txt_buf guid_buf;
@@ -528,7 +528,7 @@ like `CHECK_STATUS`, `CHECK_VAL` and others.
528528

529529
Don't do this:
530530

531-
```
531+
```c
532532
frame = talloc_stackframe();
533533

534534
if (ret == LDB_SUCCESS) {
@@ -551,7 +551,7 @@ Don't do this:
551551
552552
It should be:
553553
554-
```
554+
```c
555555
frame = talloc_stackframe();
556556
557557
if (ret != LDB_SUCCESS) {
@@ -580,7 +580,7 @@ It should be:
580580

581581
Use these following macros instead of DEBUG:
582582

583-
```
583+
```c
584584
DBG_ERR log level 0 error conditions
585585
DBG_WARNING log level 1 warning conditions
586586
DBG_NOTICE log level 3 normal, but significant, condition
@@ -590,7 +590,7 @@ DBG_DEBUG log level 10 debug-level message
590590

591591
Example usage:
592592

593-
```
593+
```c
594594
DBG_ERR("Memory allocation failed\n");
595595
DBG_DEBUG("Received %d bytes\n", count);
596596
```
@@ -613,7 +613,7 @@ The PRIuxx specifiers are standard.
613613
614614
Example usage:
615615
616-
```
616+
```c
617617
D_DEBUG("Resolving %"PRIu32" SID(s).\n", state->num_sids);
618618
```
619619

0 commit comments

Comments
 (0)