-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
076bf1e
commit d35fd00
Showing
7 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
junkcode/src/main/java/com/luoye/dpt/junkcode/JunkClass1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.luoye.dpt.junkcode; | ||
|
||
public class JunkClass1 { | ||
public JunkClass1() { | ||
System.exit(0); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
junkcode/src/main/java/com/luoye/dpt/junkcode/JunkClass2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.luoye.dpt.junkcode; | ||
|
||
public class JunkClass2 { | ||
public JunkClass2() { | ||
System.exit(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Created by luoyesiqiu on 2024/9/7. | ||
// | ||
|
||
#include "dpt_string.h" | ||
|
||
int dpt_memcmp(const void *cs, const void *ct, size_t count) | ||
{ | ||
const unsigned char *su1, *su2; | ||
int res = 0; | ||
|
||
for (su1 = (unsigned char *)cs, su2 = (unsigned char *)ct; 0 < count; ++su1, ++su2, count--) | ||
if ((res = *su1 - *su2) != 0) | ||
break; | ||
return res; | ||
} | ||
|
||
size_t dpt_strlen(const char *s) | ||
{ | ||
const char *sc; | ||
|
||
for (sc = s; *sc != '\0'; ++sc) | ||
/* nothing */; | ||
return sc - s; | ||
} | ||
|
||
char *dpt_strstr(const char *s1, const char *s2) | ||
{ | ||
size_t l1, l2; | ||
|
||
l2 = dpt_strlen(s2); | ||
if (!l2) | ||
return (char *)s1; | ||
l1 = dpt_strlen(s1); | ||
while (l1 >= l2) { | ||
l1--; | ||
if (!dpt_memcmp(s1, s2, l2)) | ||
return (char *)s1; | ||
s1++; | ||
} | ||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Created by luoyesiqiu on 2024/9/7. | ||
// | ||
|
||
#ifndef DPT_DPT_STRING_H | ||
#define DPT_DPT_STRING_H | ||
|
||
#include <string.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
int dpt_memcmp(const void *cs, const void *ct, size_t count); | ||
size_t dpt_strlen(const char *s); | ||
char *dpt_strstr(const char *s1, const char *s2); | ||
#ifdef __cplusplus | ||
}; | ||
#endif | ||
#endif //DPT_DPT_STRING_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters